PUT method to update a task returns "Unknown object" error

Below is my httр request and asana’s response.
I can read a Task with GET, I am able to create a Task with POST,
However PUT returns me the error, although I do the PUT request as it described in API Reference.
What might be wrong?

--------------------------- Request ------------------------------

PUT https://app.asana.com/api/1.0/tasks/2000000000000123 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 0/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Host: app.asana.com
Content-Length: 41

{“data”:{“name”:“New name for the task”}}

--------------------------- Response ------------------------------
HТTP/1.1 404 Not Found
Server: nginx
Date: Fri, 24 Jan 2020 01:39:09 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 230
Connection: keep-alive
Cache-Control: no-store
pragma: no-cache
Set-Cookie: TooBusyRedirectCount=0
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Security-Policy: report-uri httрs://app.asana.com/-/csp_report?report_only=false;default-src ‘none’;frame-src ‘none’;frame-ancestors ‘none’
X-Asana-Api-Version: 1.0
Asana-Change: name=string_ids;info=httрs://asa.na/api-string-ids;affected=true
Asana-Change: name=new_sections;info=httрs://asa.na/api-sections
X-Robots-Tag: none

{“errors”:[{“message”:“task: Unknown object: 2000000000000123”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: httрs://asana.com/developers/documentation/getting-started/errors”}]}

The syntax looks right, offhand.

Where did you get that Task ID from? Are you 100% sure a task with that ID exists? Also, is it possible that the API key you’re using does not have access to that task? That would also lead to an “unknown object” error, I think.

3 Likes

Phil, yes you are right!
My silly mistake, I used different tokens for read and update, and the second token had no access to the Task.
The problem is solved.

2 Likes