Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,864
Community Members
 
Community Events
184
Community Groups

Jira Xray Rest Api Create TestPlan

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
Егор Митрофанов
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 05, 2023 • edited

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

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

{
    "fields": {
       "project":
       {
          "key": "PROJECT_KEY"
       },
       "summary": "[Name]",
       "description": "[Description]",
       "issuetype": {
          "name": "Test" // for example "Test Plan" ,also "Test Set"
       }
   }
}
Like # people like this

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

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