Jump to content

Find what you are searching for in new API.


Recommended Posts


Working with the new API, I find that I either have to know what I want from a entity or explore with an existing entity.

What I liked about the old API was that I could search the reference for the methods to use without having to have an existing entity.

Is there any workflows for this, or is the intention that we explore from existing entities?

Link to comment
Share on other sites

Hey there,

there was talk about docs. For now you can use the attributes and .keys properties/methods. Here is a snippet that prints a map of the available types and properties:


import ftrack_api

session = ftrack_api.Session(

ftypes = session.types
for ftype in sorted(ftypes):
    print ftype
    for attribute in sorted(ftypes[ftype].attributes.keys()):
        print "\t" + attribute


Link to comment
Share on other sites

10 minutes ago, Mattias Lagergren said:

Yes, ultimately we want to provide better api reference docs. It is however not as straightforward as we would like, as the docs needs to be dynamically built based on the current schemas. E.g. object types are not static and may change depending on setup.

Yeah, I thought that might be a problem. Though I would suggest having something like what @instinct-vfx posted in the docs, instead of ">>> print session.types.keys()" in http://ftrack-python-api.rtd.ftrack.com/en/stable/tutorial.html. Personally I thought I could do this, but it errors and wants a entity;

ftypes = session.types
for ftype in sorted(ftypes):
    print ftype
    print ftypes[ftype].keys()


Link to comment
Share on other sites

+1 A dedicated section on introspection in the docs would be useful.

Some more explicit examples:

# List entity types available to session
>>> print sorted(session.types.keys())
[u'Appointment', u'Asset', u'AssetBuild', u'AssetType', u'AssetVersion', u'AssetVersionLink', u'AssetVersionList', u'BacklogGroup', u'Component', u'ComponentLocation', u'ContainerComponent', u'Context', u'Conversation', u'CustomAttributeConfiguration', u'CustomAttributeType', u'CustomAttributeValue', u'Disk', u'EntitySetting', u'Episode', u'Event', u'Feed', u'FileComponent', u'Folder', u'Group', u'Information', u'Job', u'JobComponent', u'List', u'ListCategory', u'Location', u'Membership', u'Message', u'Metadata', u'Milestone', u'Note', u'NoteCategory', u'NoteComponent', u'ObjectType', u'Participant', u'Priority', u'Project', u'ProjectSchema', u'ProjectSchemaOverride', u'Queue', u'Recipient', u'Resource', u'ReviewSession', u'ReviewSessionInvitee', u'ReviewSessionObject', u'ReviewSessionObjectStatus', u'Schema', u'SchemaStatus', u'SchemaType', u'Scope', u'Sequence', u'SequenceComponent', u'Setting', u'Shot', u'State', u'Status', u'Task', u'TaskTypeSchema', u'Taskgroup', u'Timelog', u'Timer', u'Type', u'TypedContext', u'TypedContextLink', u'TypedContextList', u'User', u'WorkflowSchema']

# Retrieve the class that represents a particular type by key.
>>> entity_type_cls = session.types.get("Shot")
>>> print entity_type_cls
<dynamic ftrack class 'Shot'>

# Examine attributes available on that entity type.
>>> print sorted(entity_type_cls.attributes.keys())
[u'_link', u'allocations', u'appointments', u'assets', u'assignments', u'bid', u'children', u'context_type', u'custom_attributes', u'description', u'end_date', u'id', u'incoming_links', u'link', u'lists', u'metadata', u'name', u'notes', u'object_type', u'object_type_id', u'outgoing_links', u'parent', u'parent_id', u'priority', u'priority_id', u'project', u'project_id', u'scopes', u'sort', u'start_date', u'status', u'status_id', u'thumbnail', u'thumbnail_id', u'timelogs', u'type', u'type_id']

# Examine a specific attribute by key.
>>> status_attribute = entity_type_cls.attributes.get("status")
>>> print status_attribute
<ftrack_api.attribute.ReferenceAttribute(status) object at 73957712>

# Check whether that attribute is mutable etc.
>>> print status_attribute.mutable




Link to comment
Share on other sites


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

  • Create New...