JIRA REST PUT设置属性值

时间:2017-09-18 15:25:44

标签: php json rest curl jira-rest-api

我正在尝试通过向/rest/api/2/issue/{issue}/worklog/{worklog}/properties/{key}发送cURL PUT来设置属性值。我不知道我应该使用哪种数据PUT,因为Atlassian API参考没有提供任何示例。我尝试了以下一些方法:

{
  "value": "test"
}

"test"

{
  "key": "key",
  "value": "test"
}

所有这些尝试都返回以下错误:

{"errorMessages":["The property value can not be empty."],"errors":{}}

我使用PHP发送请求。这是相关代码:

$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, $userpwd);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_PUT, 1);
$response = (curl_exec($curl));
curl_close($curl);

有谁能告诉我PUT的正确值是什么?

0 个答案:

没有答案