0

I'm wondering how to use the Asana APIs to send the command to complete a task.

I was trying something like:

https://app.asana.com/api/1.0/tasks/417207316735809/?opt_pretty&completed=true

but it doesn't work like that, I've checked the documentation, but couldn't find an answer.

Asana doc (someone requested it in comments): https://asana.com/developers/documentation/getting-started/input-output-options

Since I want to use it in my chrome extension I can't use curl so I treid ajax:

$.ajax({ 
   type : "GET", 
   url : "https://app.asana.com/api/1.0/tasks/417207316174232/?opt_pretty", 
   data: {
        completed: true,
    },
   success : function(result) { 
   result = JSON.stringify(result);
        alert(result);
   }, 
   error : function(result) { 
        alert('xxx');
   } 
 }); 

Any idea how to pass "completed=true" from doc in js?

atgn
  • 3
  • 5
  • Hello, welcome to SO. I've formatted the URL as code and added the asana-api tag. However you should show the full command that you are using, including the `curl` keyword and all the parameters. A link to the documentation that you consulted would also look good. Good luck! – Fabio says Reinstate Monica Oct 26 '17 at 23:36
  • Hello :) The documentation for Asana:https://asana.com/developers/documentation/getting-started/input-output-options – atgn Oct 27 '17 at 09:40
  • Please [edit] your question again and add the link there, then. The reason is that not everybody reads comments, and in any case comments might be deleted without notice in case it's needed to clean up the question (unlikely to happen here, but still...). Thank you! – Fabio says Reinstate Monica Oct 27 '17 at 11:46
  • No problem I've added it. – atgn Oct 27 '17 at 11:48

1 Answers1

0

If you are updating a resource you need to make a PUT request, not a GET request.

When I made this change, your AJAX request worked.

Jeff
  • 456
  • 2
  • 5