我正在尝试使用PHP中的REST API创建问题。这是我的代码。但是
$headers = array(
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Bearer' => $access_token //api token from https://confluence.atlassian.com/cloud/api-tokens-938839638.html
);
$body = <<<REQUESTBODY
{
"fields": {
"project":
{
"key": "<PROJECT KEY>"
},
"issuetype": {"id": "<ISSUE ID>"},
"subtask": "false",
}
}
REQUESTBODY;
$response = Unirest\Request::post(
'https://mydomain.atlassian.net/rest/api/3/issue',
$headers,
$body
);
但是它返回
[issuetype] => The issue type selected is invalid.
[project] => Anonymous users do not have permission to create issues in this project. Please try logging in first.
似乎问题ID无效,因为我从“ rest / api / latest / issuetype”中获得了issueType ID
我必须在某处设置许可。但是我找不到在哪里可以设置权限。我正在使用Jira Cloud的试用帐户。试用帐户有任何限制吗?
我在标题中看到[X-AUSERNAME] =>匿名。如何设置用户名?