Assign a person to task?


#1

Hello Everbody ,I need your help about Assign a person to task .Normally , ı can make adding followers 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****** + "/addFollowers  ",
    
  •             "method": "POST",
    
  •             "timeout": 0,
    
  •             "headers": {
    
  •                 "Authorization": "**********************"
    
  •             },
    
  •             "data": {
    
  •                 "followers": b*****
    
  •             }
    
  •         };
    
  •         $.ajax(settings).done(function (response) {
    
  • console.log(response);

Can you help about this subject ?
Thank You


#2

There is an assignee field you can use on task objects. Have a look at https://asana.com/developers/api-reference/tasks#create and get back to us if you still struggle.


#3

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);

#4

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


#5

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


#6

addFollowers is an endpoint in your example. assignee is a field you need to fill when calling the update or create endpoint https://asana.com/developers/api-reference/tasks#update


#7

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