laura.c Posted November 8, 2017 Report Share Posted November 8, 2017 Hi everyone, is it possible to query ftrack db for calendar events? For eg, we would like to check if an user is booked on a specific project on a given period. Thank you! Link to comment Share on other sites More sharing options...
Lucas Correia Posted November 9, 2017 Report Share Posted November 9, 2017 Hi Laura, Sure, they are exposed through the API as CalendarEvent and CalendarEventResource entities. Here is an example query to look if someone is booked on a particular project during an interval (in server time/UTC). session.query( 'CalendarEventResource ' 'where calendar_event.project.name is "test" ' 'and resource[User].username is "lucas.correia" ' 'and calendar_event.start <= "2017-11-09T23:59:59" ' 'and calendar_event.end >= "2017-11-09T00:00:00" ' ).first() Regards, Lucas Link to comment Share on other sites More sharing options...
laura.c Posted November 9, 2017 Author Report Share Posted November 9, 2017 Hi Lucas, Many thanks for the example. It's exactly what we need! Where can we find the list with all entities that can be queried with the new API? Regards, Laura Link to comment Share on other sites More sharing options...
Lucas Correia Posted November 9, 2017 Report Share Posted November 9, 2017 Hi, There is currently no list available. We plan to create a page where you can explore API entities and attributes, but haven't gotten around to it yet. In the meantime, you can use the following code to print all entities and attributes: for name, entity_type in sorted(session.types.items()): print name for attribute in sorted(entity_type.attributes.keys()): print '\t {} ({})'.format( attribute, entity_type.attributes.get(attribute).__class__.__name__ ) print '' Read more in the tutorial here. Regards, Lucas Link to comment Share on other sites More sharing options...
laura.c Posted November 9, 2017 Author Report Share Posted November 9, 2017 Thank you Lucas! Regards, Laura Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.