Create task 400 response code but no error data

Hi, so I’ve been having an issue attempting to create a task via the Asana API. I’m using PHP/cURL and most of the time the ability works but I’ve recently been experiencing 400 return codes via the following URL that I post to:-

https://app.asana.com/api/1.0/tasks?

Like I say I get a 400 response but no ‘error’ data with it as expected, to help narrow down the exact problem. My PHP debugging just says the response is ‘false’. The following is a snippet of what I’m debugging to see the 400 and response:-

$this->response = curl_exec($curl); = ‘false’
$this->responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); = 400

Is there anything else I need to POST to the API to get a more coherent data response upon error?

Many thanks

1 Like

Upon further investigation the create task returns NULL and fails to create the task. Before I attempt to create the task I create a project, which works successfully.

For reference here is the JSON I’m attempting to post to create the task:-

{
“data”:{
“workspace”:“360142226816574”,
“assignee”:“727823641356243”,
“projects”:[“1184059315729550”],
“custom_fields”:{
“707926551301031”:“707926551301032”,
“827799850883241”:“859088912919009”
},
“name”:“Fixed Dev Task Name”,
“start_on”:“2020-07-16”,
“due_at”:“2020-07-16T10:30:00Z”
}
}

Many thanks

So I managed to figure this out - seems as though you can’t have the ‘start_on’ and ‘due_at’ / ‘due_on’ fields having the same date information.

Hope this helps someone

2 Likes

@Ross_Grambo maybe this could be added to the API docs? :slight_smile:

Creating a task now :slight_smile:

1 Like

just helped me!