Assign a person to task?

Hello Everbody ,I need your help about Assign a person to task .Normally , ı can make adding collaborators to a task. But my purpose is I wanna just Assign section adding a person to Task. As you can see my code :

  •        var settings = {
    
  •             "url": "https://app.asana.com/api/1.0/tasks/" + a****** + "/addCollaborators  ",
    
  •             "method": "POST",
    
  •             "timeout": 0,
    
  •             "headers": {
    
  •                 "Authorization": "**********************"
    
  •             },
    
  •             "data": {
    
  •                 "collaborators": b*****
    
  •             }
    
  •         };
    
  •         $.ajax(settings).done(function (response) {
    
  • console.log(response);

Can you help about this subject ?
Thank You

There is an assignee field you can use on task objects. Have a look at Build an app with Asana and get back to us if you still struggle.

Hello again ,I did but It’s not working :frowning:
* var settings = {

  •             "url": "https://app.asana.com/api/1.0/tasks/" + ((a=TaskID)) + "/assignee  ",
    
  •             "method": "POST",
    
  •             "timeout": 0,
    
  •             "headers": {
    
  •                 "Authorization": "*******************"
    
  •             },
    
  •             "data": {
    
  •                 "name": ((b=UserName))
    
  •             }
    
  •         };
    
  •         $.ajax(settings).done(function (response) {
    
  •             console.log(response);
    

You need to use the assignee field and pass the id of the assignee I believe.

Okay , I’m sorry but ı have a quastion . So, What’s the process diffrences beetween addCollaborators and assignee a person to task ?

addCollaborators is an endpoint in your example. assignee is a field you need to fill when calling the update or create endpoint Build an app with Asana

1 Like

I’ve realized problem now and I have solved , Thank you for Link :slight_smile:

1 Like