我正在尝试向WorkFront(以前称为AtTask)中的项目添加新任务。我已成功创建CURL连接以发布请求,但API仅获取任务名称和持续时间值。任何dateTime字段都将被忽略。有关如何设置任务截止日期或所需完成日期的任何建议?它必须非常简单,但我有些错过它。
$taskName = urlencode($_GET['newtask']);
$attask_newtask_url = 'https://[my server name]/attask/api/v4.0/task';
$now = time()+2880;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $attask_newtask_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
'name'=>$taskName,
'projectID'=>[my project id],
'sessionID'=>$sessionID,
'duration'=> (720/1440),
'projectedStartDate'=>"07/27/2011"
)));
任何帮助都将不胜感激。
由于
答案 0 :(得分:0)
预计持续时间是系统计算字段,不可编辑。要更改开始日期,您需要编辑plannedStartDate。
例如你的代码应该是。
$taskName = urlencode($_GET['newtask']);
$attask_newtask_url = 'https://[my server name]/attask/api/v4.0/task';
$now = time()+2880;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $attask_newtask_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
'name'=>$taskName,
'projectID'=>[my project id],
'sessionID'=>$sessionID,
'duration'=> (720/1440),
'plannedStartDate'=>"07/27/2011"
)));