Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Xray REST API provides the following endpoints for managing the Test Repository information of a given project. 

Some endpoints support pagination, using the page and limit query parameters.

Hierarchy

  • To obtain a list of all Test Repository folders of a given project, including their hierarchy information, you need to specify the key of the respective project.

...

  • To obtain a list of the Tests associated with the Test Repository of a given project, you need to specify the key of project
  • To obtain a list of the Tests contained within a given Test Repository folder, you need to specify its folderId, besides the project key
  • To change (add/remove) Tests to a given folder, you need to specify the key of the respective project

Expand
titleGET /rest/raven/1.0/api/testrepository/<projectKey>/folders/<folderId>/tests
Panel
borderColor#ccc
borderStylesolid

Returns a JSON object with a list of the Tests contained in a given folder of the Test Repository.

This endpoint supports pagination.

Request

PATH PARAMETERS
parametertypedescription
projectKeyString

project key

folderIdIntegerinternal folder Id; "-1" corresponds to the root folder of the Test Repository


QUERY PARAMETERS
parametertypedescription
allDescendants
Boolean

include all descendants (i.e. all child Tests); "false", by default

pageIntegerpage of paginated data (first 1)
limitIntegeramount of Tests per paginated data
Tip
titleRequest examples

curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver/rest/raven/1.0/api/testrepository/<projectKey>/folders/<folderId>/tests

curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver//rest/raven/1.0/api/testrepository/<projectKey>/folders/<folderId>/tests?allDescendants=true


Responses

200 OK : text/plain : Successful. Returns a JSON object containing the Tests.


Each test will provide some information, including:

  • id: internal Test Id
  • key: Test's issue key
  • summary: Test's summary
  • assignee: Test's issue assignee
  • rank: rank of the Test in the parent folder ("1" corresponds to the first element)
  • workflowStatus: Test's workflow status
  • labels: array of all Test's assigned labels
  • components: array of all Test's assigned components
  • testType: Test type (e.g. "Manual", "Cucumber, "Generic")


Code Block
titleOutput example for listing only the direct descendants of a given folder
{
 "tests": [
   {
    "id": 24300, 
    "key": "FP-10",
    "summary": "Issue test create inside folder",
    "assignee": "",
    "rank": 1,
    "workflowStatus": "Open",
    "labels": [],
    "components": [],
    "testType": "Manual",
   },
   {
    "id": 24301,
    "key": "FP-11",
    "summary": "Issue test create inside folder",
    "assignee": "",
    "rank": 2,
    "workflowStatus": "Open",
    "labels": [],
    "components": [],
    "testType": "Manual",
   },
   {
    ...
   }
  ],
  "total": 3,
}
Code Block
titleOutput example for listing all descendants of a given folder
{
 "tests": [
   {
    "id": 24300,
    "key": "FP-10",
    "summary": "Issue test create inside folder",
    "assignee": "",
    "rank": 1,
    "workflowStatus": "Open",
    "labels": [],
    "components": [],
    "testType": "Manual",
   },
   {
    "id": 24301,
    "key": "FP-11",
    "summary": "Issue test create inside folder",
    "assignee": "",
    "rank": 1,
    "workflowStatus": "Open",
    "labels": [],
    "components": [],
    "testType": "Manual",
   },
   {
    ...
   }
  ],
  "total": 3,
}

400 BAD_REQUEST : text/plain : Returns the error.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred getting the tests.

Expand
titlePATCH PUT /rest/raven/1.0/api/testrepository/<projectKey>/folders/<folderId>/tests
Panel
borderColor#ccc
borderStylesolid

Add/remove tests to/from the given Test Repository folder. Returns error messages, if there are any.

Request

PATH PARAMETERS
parametertypedescription
projectKeyString

project key

folderIdintegerinternal folder Id
Example
Code Block
titleExample Input
{
 "add": [
    "CALC-33",
    "CALC-75"
  ],
  "remove": [
    "CALC-25",
    "CALC-45"
  ]
}
Tip
titleRequest example
curl -H "Content-Type: application/json" -X PATCH PUT -u admin:admin --data @example.json http://yourserver/rest/raven/1.0/api/testrepository/FP/folders/9/tests


Responses

200 OK : text/plain : Successful. Return error messages, if there are any.

Code Block
titleExample Output
["Issue with key CALC-33 not found or is not of type Test."]

400 BAD_REQUEST : text/plain : Returns the error.

401 UNAUTHORIZED : text/plain : The Xray for JIRA license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred associating the tests.

...