lukas g Posted August 2, 2018 Report Share Posted August 2, 2018 Hey, I need to query all priorities and also set the priority of entities. sth. like thsi maybe: priorities = session.get_priorities() ? entity["priority"] = priorities[0] Best Lukas Link to comment Share on other sites More sharing options...
Yas Opisso Posted August 2, 2018 Report Share Posted August 2, 2018 Here's a quick snippet for you. import ftrack_api # Your info goes here session = ftrack_api.Session( server_url='http://your.server.com', api_key='11111111-22222-33333-44444-5555555555555555', api_user='yourusername' ) # Queries all priorities (so you can know their names/values/id etc) priorities = session.query('Priority').all() for p in priorities: print p.keys() # Queries a priority by name priority_name = 'Extreme' # 'Low, Medium, High' priority_extreme = session.query('Priority where name is "{}"'.format(priority_name)).one() # Queries a task/entity ftrack_task_id = 'a2db5442-8c56-11e8-83ac-0cc47adee6c0' ftrack_entity = session.query('Task where id is "{}"'.format(ftrack_task_id)).one() # Set's the priority ftrack_entity['priority'] = priority_extreme # Commits the changes session.commit() Link to comment Share on other sites More sharing options...
lukas g Posted August 3, 2018 Author Report Share Posted August 3, 2018 Thank you very much. that was easy I did not even think about the regular query to get them Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.