简体   繁体   中英

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. 在此输入图像描述 "

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. 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. You just have to set all the desired fields and custom fields in the json that you post to JIRA.

You did not list the exact content that you send to JIRA, so I'm not entirely sure which REST resource you use.

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. 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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