I am using following Php CURL base codee to create the task, but it is not working:
$WCURL = ‘https://app.asana.com/api/1.0/tasks’;
$postFields = array (
‘name’ => ‘Buy catnip’,
‘assignee_status’ => ‘upcoming’,
‘completed’ => false,
‘html_notes’ => ‘Mittens really likes the stuff from Humboldt.’,
‘workspace’ => ‘1112458401245755’,
‘projects’ => array (
0 => ‘1112457859980672’,
),
“parent” => null
);
$postFields = json_encode($postFields);
$CURLHTTPHeader = array(
‘Content-Type: application/json’,
‘Accept: application/json’,
‘Authorization: Bearer ---------’
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$WCURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HTTPHEADER,$CURLHTTPHeader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curlResponse = curl_exec ($ch);
curl_close ($ch);
echo ‘
’;’;
print_r($curlResponse);
echo ‘
Error : “You should specify one of workspace, parent, projects”
Please help me. Thanks in advance!