Jira Xray Rest Api Create TestPlan

Kamil Wach April 25, 2018

Hi, I cannot find how to create/get  testplan or testset via rest-api. 

I search in Jira's native REST API, but I still cannot find how to do it. 

Could someone help me ?

2 answers

0 votes
Егор Митрофанов May 5, 2023

Good morning.
As a topic starter we use Jira + X-Ray.
I can't create a TestPlan via jira api. 

When I send a post request to https://jira_host/jira/rest/api/2/issue/
with body

{
"fields": {
"project": {"key": "PROJECT_KEY"},
"summary": "[Name]",
"description": "[Description]",
"issuetype": {"name": "Test Plan"},
},
"update": {
"issuelinks": [
{"add": {"type": {"id": "11700"}, "outwardIssue": {"key": "ISSUE_KEY"}}}
]
},
}

I get an error with status code 400: errors: {"issuelinks": "Введите запрос для связи"}
"Введите запрос для связи" means specify issue to link, I don't know exactly how it in english version.

If I create a Test Plan using the web interface then I must specify a link to the ISSUE_KEY.

I've found workaround: I can create two issues and than change issue type for one of them:

Creation parameters for post request:

{
"fields": {
"project": {"key": "PROJECT_KEY"},
"summary": "[Name]",
"description": "[Description]",
"issuetype": {"id":"10701"}
}
}

 

After creation I send PUT request to
https://jira_host/jira/rest/api/2/issue/ISSUE_ID for change issue type.

with body:

{ 
    "fields": {
        "issuetype": {"name": "Test Plan"}
},
    "update": {
        "issuelinks": [
         {
            "add": {
                "type": {
                    "id": "11700"
                   },
                  "outwardIssue": {
                       "key": "KEY_TO_LINK"
}}}]}}

 

After above manipulations I have desired result. But I don't like this approach.
Please, help me to figure out. Are the any features of creation an ISSUE that must be related with another one.

0 votes
José Domingues [Xray]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 30, 2018

Hi Kamil,

Creating a testplan or testset via rest-api is similar to creating a test.

You can find the steps/example in this links:

https://confluence.xpand-addons.com/display/XRAY31/Tests+-+REST#Tests-REST-CreatingandEditingTests-JiraRESTAPI

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#creating-an-issue-examples

 

Best regards,

Xpand Add-ons Team

holding telnet December 20, 2018

hi @José Domingues [Xray],

please have you a script or a document to help me , I'am very new on  JIra xray & jira rest api

thanks in advance

Kamil Wach December 21, 2018
{
    "fields": {
       "project":
       {
          "key": "PROJECT_KEY"
       },
       "summary": "[Name]",
       "description": "[Description]",
       "issuetype": {
          "name": "Test" // for example "Test Plan" ,also "Test Set"
       }
   }
}
Like # people like this
Guille Netsuite January 11, 2019

Hi,

 

could we have some further example as on the way to attach a test set to a test plan?

Can it be done on the API request of the creation of the test set?

Thanks in advance

Lahiru Wijesinghe February 23, 2019

Hi @Kamil Wach ,

Do you know to assign test cases to a Test run using Jira REST API ?

 

/LahiruW

José Domingues [Xray]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 15, 2019

Hi @Guille Netsuite and @Lahiru Wijesinghe

First, let me share this link with you where you can find the differences between Test Sets and Test Plan in Xray context. 

And here you can find information on how to: 

 

Lastly, you can find all related information about REST API in our documentation and if you need to import tests results (tests runs information) into a Test, you can do also do it by using the REST API (see our guide).

 

For further information, please, contact the support team

 

Best regards,

Xray Team

Like durganath ssi likes this

Suggest an answer

Log in or Sign up to answer