1
我似乎試圖使用Asana API卡住了。我正在嘗試在特定項目上發佈任務。通過CURL發佈特定項目的任務
這裏就是我想:
$api = 'myapikey';
$url = 'https://app.asana.com/api/1.0/tasks';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Don't print the result
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // Don't verify SSL connection
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // "" ""
curl_setopt($curl, CURLOPT_USERPWD, $api);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
$data = array(
"data" => array(
"workspace" => "workspace id",
"name" => "Task Name",
"notes" => "notes",
"assignee" => "assignee id"
)
);
$data = json_encode($data);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$html = curl_exec($curl);
curl_close($curl);
$html = json_decode($html);
var_dump($html);
它沒有工作,它創建Undefined Project
任務。我試着用以下變化:
$url = 'https://app.asana.com/api/1.0/projects/4649161839339/tasks';
$url = 'https://app.asana.com/api/1.0/tasks/projects/4649161839339';
任何想法?
嗯,我沒有找到它。我會試試這個。 – Starx 2013-04-13 02:28:42
您應該考慮將其添加到文檔中。 – Starx 2013-04-13 02:44:17