Query Calendar events
2 2

5 posts in this topic

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!

 

 

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2