Est Posted July 13, 2017 Report Posted July 13, 2017 Hi all, I'm porting some code using the old ftrack api to the new api. I found replacements for most of the old api uses in the code but I'm stuck with ftrack.Project.getUsers(). What's the equivalent using the new api? Thanks! Est.
Yas Opisso Posted July 14, 2017 Report Posted July 14, 2017 # This will query all the users. Uncomment the print statement # if you want to see what keys are available to the entity users = session.query('User').all() for user in users: # print user.keys() print user['username'] # If you know what values you need you can use select to speed things up # Carefull, too many selects can actually slow you down on large queries users = session.query('select username from User').all() for user in users: print user['username'] # Ultimately if you want to query a specific user here's how you do it. # Replace JDoe with the actual user name. users = session.query('User where username is "{}"'.format(JDoe)).all() for user in users: print user['username']
Mattias Lagergren Posted July 14, 2017 Report Posted July 14, 2017 Getting all users assigned to a project is not super straightforward but should be possible: session.query('User where assignments.context.project.name is "test"').first()
Est Posted July 14, 2017 Author Report Posted July 14, 2017 Hi Mathias, Works perfectly. Thanks! Est.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.