Can`t create task with API

Try to create tasks via zennoposter + curl snippet

After request cant find any task on me…
What i do wrong?

Request
curl -H “Authorization: Bearer 0/b1903090887371fa1f2f24c344xxxxxx”
https://app.asana.com/api/1.0/tasks?workspace=45242660013xxx&assignee=ramonchek@xxx.xx&notes=Howareyoutoday&name=Hello,world!&limit=5

Result
{“data”:[{“id”:980157237568xxx,“gid”:“980157237568xxx”,“name”:“5 - redirects”,“resource_type”:“task”},{“id”:980157237568367,“gid”:“980157237568xxx”,“name”:“5 - website analysis”,“resource_type”:“task”},{“id”:980157237568xxx,“gid”:“980157237568xxx”,“name”:“tier 2”,“resource_type”:“task”},{“id”:980157237568xxx,“gid”:“980157237568xxx”,“name”:“5 - redirects”,“resource_type”:“task”},{“id”:980157237568xxx,“gid”:“980157237568xxx”,“name”:“5 - website analysis”,“resource_type”:“task”}],“next_page”:{“offset”:“eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJib3JkZXJfcmFuayI6IltcIlY3UzRETUNVMENWXCIsOTgwMTU3MjM3NTY4MzQ5XSIsImlhdCI6MTU0ODY5NjY4NCwiZXhwIjoxNTQ4Njk3NTg0fQ.H-yEHhAGJo5fDbDN2l0HUFt2ea2MgAnoZTOR1tJtmko”,“path”:“/tasks?name=Hello%2Cworld%21&assignee=ramonchek%40xxx.xx&offset=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJib3JkZXJfcmFuayI6IltcIlY3UzRETUNVMENWXCIsOTgwMTU3MjM3NTY4MzQ5XSIsImlhdCI6MTU0ODY5NjY4NCwiZXhwIjoxNTQ4Njk3NTg0fQ.H-yEHhAGJo5fDbDN2l0HUFt2ea2MgAnoZTOR1tJtmko&workspace=45242660013xxx&notes=Howareyoutoday&limit=5”,“uri”:“https://app.asana.com/api/1.0/tasks?name=Hello%2Cworld!&assignee=ramonchek%40xxx.xx&offset=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJib3JkZXJfcmFuayI6IltcIlY3UzRETUNVMENWXCIsOTgwMTU3MjM3NTY4MzQ5XSIsImlhdCI6MTU0ODY5NjY4NCwiZXhwIjoxNTQ4Njk3NTg0fQ.H-yEHhAGJo5fDbDN2l0HUFt2ea2MgAnoZTOR1tJtmko&workspace=45242660013xxx&notes=Howareyoutoday&limit=5”}}

Are you doing a POST request or a GET request?

Looks like GET request, buy have no idea how to operate with CURL

Find some information. To convert get to post i need to add --data to request

With this request i get authorization error
curl -H --data “Authorization: Bearer 0/b1903090887371fa1f2f24c344xxxxxx”
https://app.asana.com/api/1.0/tasks?workspace=45242660013xxx&assignee=ramonchek@xxx.xx&notes=Howareyoutoday&name=Hello,world!&limit=5

And with this same result wit all my tasks
curl -H “Authorization: Bearer 0/b1903090887371fa1f2f24c344xxxxxx” / --data
https://app.asana.com/api/1.0/tasks?workspace=45242660013xxx&assignee=ramonchek@xxx.xx&notes=Howareyoutoday&name=Hello,world!&limit=5

I’m not entirely clear if you’re having trouble with creating a task or with reading already-created tasks; if it’s the former (which I think it is) then here’s an example of creating a task using CURL:

Note this sample uses JSON which is how I recommend you do it.

1 Like