api: assigning a task to someone?

Im having some difficulty assigning a task to a user, no problem creating it but it keeps throwing the error;

API create() Task.task_assignees expected [Array] data type(s) but got Hash:

{"type"=>"HumanUser", "id"=>45}#


this is my code:

createRendTaskData = { 'project': {'type':'Project','id':66},

'content': 'Please render',


'start_date': today,

'task_assignees': {'type':'HumanUser','id':45},

'step': {'type': 'Step', 'id':36},

'entity': {'type':entity,'id':entityResult['id']} }


createRendTaskResult = sg.create('Task',createRendTaskData)


taking the task_assignees out it works, and i cant seem to find any documentation on it either? It seems like its a silly mistake on my part but i cant figure it out.


2 条评论

  • 0

    ah got it now, should read the error properly, my mistake.

  • 0
    Ben Hadden

    Hi Lee, are you still having trouble with this?  task_assignees is a multi-entity field, so Shotgun expects a list.  If you add brackets around your entity hash like this:


    It should work.  Let me know if it does.