Are you using Xray for Jira Cloud and want to export Xray information?
Have you ever used Insomnia software and need some tips?
This article is for you. It's a step-by-step how to export Xray information using Insomnia.


Possible Causes

  • Need to export bulk information from Xray;
  • Never used Insomnia software

Step-by-step guide


1 - REST API authentication

Define your API KEY

Go to Jira settings > Apps > Xray > API Keys

Then Create API Key > Search for your user

Click Generate

Now you have two information’s: Client ID and Client Secret


2 - Obtain a token

You can use the command prompt, and use this example requests to get the token id:

curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "32A27E69B0AC4E539C1401643799E8E7","client_secret": "d62f81eb9ed859e11e54356dd8a00e4a5f0d0c2a2b52340776f6c7d6d757b962" }'  https://xray.cloud.getxray.app/api/v2/authenticate

The output will be a string like this one:


3  - Install Insomnia

In our documentation related to GraphQL you can find at the end of the first page reference to Insomnia:


This open source will help you to use this feature: https://insomnia.rest/graphql/


4 - Once you install the software, you can define a new request:



5 - Go to Bearer tab


6 - Choose Bearer Token



7 - Paste your token


8 - Go to GraphQL tab > Paste your query



You can see here some examples: https://xray.cloud.getxray.app/doc/graphql/gettest.doc.html

If you want to know your issue Id, go to the issue and put the cursor on the Edit button:



9 - Enter the endpoint: http://xray.cloud.getxray.app/api/v2/graphql


10 - Click SEND



11 - In the right side you will have the result:


In this case, this is the issue:


And this is the result:

{

  "data": {

    "getTest": {

      "issueId": "15566",

      "testType": {

        "name": "Manual",

        "kind": "Steps"

      },

      "steps": [

        {

          "id": "4c2d6f40-eb72-49c7-9314-e37dae519dab",

          "data": "Data1",

          "action": "Step number 1",

          "result": "Result1",

          "attachments": []

        },

        {

          "id": "54f7405c-5a4e-458c-b910-fa6d710f22a1",

          "data": "Data2",

          "action": "Step number 2",

          "result": "Result2",

          "attachments": []

        },

        {

          "id": "7d0d141c-624e-4374-94b0-d78dc838d866",

          "data": "Data3",

          "action": "Step number 3",

          "result": "Result3",

          "attachments": []

        }

      ]

    }

  }

}

Link for related documentation

Authentication - REST

https://insomnia.rest/graphql/

https://xray.cloud.getxray.app/doc/graphql/gettest.doc.html