通过REST API - PHP在选项卡式屏幕上创建JIRA问题

kya*_*kya 6 php rest jira

我有以下带有TABS的JIRA屏幕,我想通过REST API在"Resquestor Details"选项卡上创建一个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;
}
Run Code Online (Sandbox Code Playgroud)

我查看了文档,但我没有真正理解它或在任何地方看到它.

我收到此错误:

无法设定.它不在适当的屏幕上,或未知.对于所有字段但字段是正确的问题类型和权限也是正确的.

Gle*_*nnV 1

如果您使用 JIRA Rest API 创建问题,即。POST /rest/api/2/issue,那么您无需考虑在 JIRA 中查看问题时显示的选项卡。您只需在发布到 JIRA 的 json 中设置所有所需字段和自定义字段。

您没有列出发送到 JIRA 的确切内容,因此我不完全确定您使用哪个 REST 资源。

您提到的错误表明您正在尝试设置一个在项目的“创建屏幕”上不可用的字段。您可以使用GET /rest/api/2/issue/createmeta资源来验证这一点。它的输出可能不会列出您尝试设置的所有字段。

要纠正此问题,您必须验证项目使用的屏幕方案,并确保与该方案关联的“创建屏幕”列出了必要的字段。相关 JIRA 文档可在此处获取。

作为旁注:您在查看问题时看到的选项卡是在项目屏幕方案的“查看问题”屏幕中定义的。