Jump to content

How to assign user to project via ftrack_api


Remus Avram

Recommended Posts

Hi all,

how can I assign a user to a project via ftrack_api?

I tried with:

        session.create("Appointment",
                       {"context": project,
                        "resource": user,
                        "type": "assignment"
                        })
        session.commit()

but I get the following error:

Server reported error: ValidationError(Appointment of type "assignment" cannot be created for "user" and "show")

 

But if I get an existing appointment of a project and inspect the data:

(Pdb) for k in allocation.keys():print k, ': ', allocation[k]
resource :  <User(55095a4c-4839-11e6-a626-005056a745dd)>
resource_id :  55095a4c-4839-11e6-a626-005056a745dd
context_id :  28d104b6-8be5-11e7-a763-005056a745de
context :  <Project(28d104b6-8be5-11e7-a763-005056a745de)>
type :  allocation
id :  0b60299c-a469-11e7-aa6e-005056a745de

the context is a project and the resource is a user.

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...