简体   繁体   English

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

[英]Create JIRA issue on a tabbed screen via REST API - PHP

I have the following JIRA screen with TABS, and I would like to create an vISSUE on the "Resquestor Details tab via REST API. 我有以下带有TABS的JIRA屏幕,我想通过REST API在“Resquestor Details”选项卡上创建一个vISSUE。 在此输入图像描述 "

Now I have the following code and I'm not sure where to specify the tab name. 现在我有以下代码,我不知道在哪里指定选项卡名称。

 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;
}

I had a look at the Documentation but I don't really get it or see it anywhere. 我查看了文档,但我没有真正理解它或在任何地方看到它。

I get this error: 我收到此错误:

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. 对于所有字段但字段是正确的问题类型和权限也是正确的。

If you use the JIRA Rest API to create an issue, ie. 如果您使用JIRA Rest API创建问题,即。 POST /rest/api/2/issue , then you do not need to think about the tabs that are displayed when you view the issue within JIRA. POST / rest / api / 2 / issue ,然后您不需要考虑在JIRA中查看问题时显示的选项卡。 You just have to set all the desired fields and custom fields in the json that you post to JIRA. 您只需在发布到JIRA的json中设置所有需要的字段和自定义字段。

You did not list the exact content that you send to JIRA, so I'm not entirely sure which REST resource you use. 您没有列出发送给JIRA的确切内容,因此我不完全确定您使用的REST资源。

The error that you mentioned, indicates that you're trying to set a field that is not available on the "Create Screen" for your project. 您提到的错误表示您正在尝试设置项目“创建屏幕”上不可用的字段。 You can verify this with the GET /rest/api/2/issue/createmeta resource. 您可以使用GET / rest / api / 2 / issue / createmeta资源进行验证。 Probably its output does not list all the fields that you try to set. 可能它的输出没有列出您尝试设置的所有字段。

To correct this, you have to verify the screen scheme that your project uses and make sure that the "Create Screen" associated with the scheme lists the necessary fields. 要纠正此问题,您必须验证项目使用的屏幕方案,并确保与方案关联的“创建屏幕”列出必要的字段。 The relevant JIRA documentation is available here . 相关的JIRA文档可在此处获得

As a sidenote: the tabs that you see when you view an issue, are defined in the "View Issue" screen of the project's screen scheme. 作为旁注:您在查看问题时看到的选项卡是在项目屏幕方案的“查看问题”屏幕中定义的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM