Jump to content

New api ftrack.Project.getUsers() equivalent


Est

Recommended Posts

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.

 

Link to comment
Share on other sites

# 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']

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...