通过 REST 在选项卡式屏幕上创建 JIRA 问题 API - PHP
Create JIRA issue on a tabbed screen via REST API - PHP
我有以下带有 TABS 的 JIRA 屏幕,我想在 "Resquestor Details tab via REST API."
上创建一个 vISSUE
现在我有以下代码,但我不确定在哪里指定选项卡名称。
public function createTestData($firstName, $surname, $userID, $email, $testPortfolio, $projectName,$projectID,
$newSystem, $newProduct, $requirementsFunction, $evinronment, $dueDate, $region,
$summary, $description)
{
if ($this->finduser($email) < 1)
{
$json = Array ( "fields" => Array (
"project" => Array
( "id" => 20207 ),
"summary" => "$summary",
"description"=>"$description",
"issuetype" => Array ( "name" => "Test Data" ),
"customfield_14421" => "$firstName",
"customfield_15026" =>"$lastName",
"customfield_14490" =>"$userID",
"customfield_14415" =>"$email",
"customfield_156681" =>Array ("value" => "$testPortfolio"),
"customfield_12103" =>"$projectName",
"customfield_14236" =>"$projectID",
"customfield_14430" =>"$newSystem",
"customfield_15672" =>"$newProduct",
"customfield_15673" =>Array ("value" => "$requirementsFunction"),
"customfield_15685" =>Array ( "value" => "$environment"),
"customfield_15700" =>"$region",
"reporter" =>Array ("name" => "API" )
)
);
}
return $json;
}
我看过 Documentation 但我并没有真正理解或在任何地方看到它。
我收到此错误:
cannot be set. It is not on the appropriate screen, or unknown. for all fields
But the fields are on the correct issue Type and permissions are also correct.
如果您使用 JIRA Rest API 创建问题,即。 POST /rest/api/2/issue,那么您在 JIRA 中查看问题时无需考虑显示的选项卡。您只需在 json 中将所有需要的字段和自定义字段设置为 post 到 JIRA。
您没有列出您发送到 JIRA 的确切内容,所以我不能完全确定您使用的是哪个 REST 资源。
您提到的错误表明您正在尝试为您的项目设置 "Create Screen" 上不可用的字段。您可以使用 GET /rest/api/2/issue/createmeta 资源验证这一点。可能它的输出没有列出您尝试设置的所有字段。
要更正此问题,您必须验证您的项目使用的屏幕方案,并确保与该方案关联的 "Create Screen" 列出了必要的字段。相关的 JIRA 文档可用 here.
作为旁注:您在查看问题时看到的选项卡是在项目屏幕方案的 "View Issue" 屏幕中定义的。
我有以下带有 TABS 的 JIRA 屏幕,我想在 "Resquestor Details tab via REST API.
现在我有以下代码,但我不确定在哪里指定选项卡名称。
public function createTestData($firstName, $surname, $userID, $email, $testPortfolio, $projectName,$projectID,
$newSystem, $newProduct, $requirementsFunction, $evinronment, $dueDate, $region,
$summary, $description)
{
if ($this->finduser($email) < 1)
{
$json = Array ( "fields" => Array (
"project" => Array
( "id" => 20207 ),
"summary" => "$summary",
"description"=>"$description",
"issuetype" => Array ( "name" => "Test Data" ),
"customfield_14421" => "$firstName",
"customfield_15026" =>"$lastName",
"customfield_14490" =>"$userID",
"customfield_14415" =>"$email",
"customfield_156681" =>Array ("value" => "$testPortfolio"),
"customfield_12103" =>"$projectName",
"customfield_14236" =>"$projectID",
"customfield_14430" =>"$newSystem",
"customfield_15672" =>"$newProduct",
"customfield_15673" =>Array ("value" => "$requirementsFunction"),
"customfield_15685" =>Array ( "value" => "$environment"),
"customfield_15700" =>"$region",
"reporter" =>Array ("name" => "API" )
)
);
}
return $json;
}
我看过 Documentation 但我并没有真正理解或在任何地方看到它。
我收到此错误:
cannot be set. It is not on the appropriate screen, or unknown. for all fields But the fields are on the correct issue Type and permissions are also correct.
如果您使用 JIRA Rest API 创建问题,即。 POST /rest/api/2/issue,那么您在 JIRA 中查看问题时无需考虑显示的选项卡。您只需在 json 中将所有需要的字段和自定义字段设置为 post 到 JIRA。
您没有列出您发送到 JIRA 的确切内容,所以我不能完全确定您使用的是哪个 REST 资源。
您提到的错误表明您正在尝试为您的项目设置 "Create Screen" 上不可用的字段。您可以使用 GET /rest/api/2/issue/createmeta 资源验证这一点。可能它的输出没有列出您尝试设置的所有字段。
要更正此问题,您必须验证您的项目使用的屏幕方案,并确保与该方案关联的 "Create Screen" 列出了必要的字段。相关的 JIRA 文档可用 here.
作为旁注:您在查看问题时看到的选项卡是在项目屏幕方案的 "View Issue" 屏幕中定义的。