Create Requirements

Create a requirement tree in the release node

Use the following operation:

POST /flex/services/rest/latest/requirementtree/add

Request format

To create a requirement in a release node, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/requirementtree/add

Request body

{ "name": "Node1", "description": "", "type": "req", "releaseIds": [ "1" ], "parentId": 0, "projectId": 1 }

parentId - pass 0 when creating under the release node.
releaseIds - the ID of the release where the requirement folder should be created.

Response body

{ "id" : 7, "name" : "Node1", "description" : "", "projectId" : 1, "parentId" : 0, "categories" : [ ], "requirements" : [ ], "releaseIds" : [ 1 ], "releaseId" : 1, "type" : "req" }

Create a requirement tree sub-folder

Use the following operation:

POST /flex/services/rest/latest/requirementtree/add

Request format

To create a requirement tree sub-folder, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/requirementtree/add

Request body

{ "name": "Sub Folder", "description": "", "type": "req", "releaseIds": [ "1" ], "parentId": 7, "projectId": 1 }

parentId - pass the ID of the parent folder where a sub-folder should be created.

Response body

Create a requirement

Use the following operation to create a requirement in Zephyr Enterprise:

POST /flex/services/rest/latest/requirement

Request format

To create a requirement, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/requirement

Request body

requirementTreeId - the ID of the tree where the requirement will be created.

Response body

Update a requirement

Use the following operation to update a requirement in Zephyr Enterprise:

PUT /flex/services/rest/latest/requirement/{id}

{id} - the requirement ID.

Request format

To update a requirement, send a PUT request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/requirement/{id}

Sample request body

Sample response

You can do this in one of the following ways:

Map a single test case to a single requirement

Use the following operation:

POST /flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

testcaseid - the ID of the test case.

releaseid - the release ID.

Request format

To map a single test case to a single requirement, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

Sample request

In this request, 10 is the requirement tree ID, and 2 is the requirement ID.

Sample response

Map a single test case to multiple requirements

Use the following operation:

POST /flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

testcaseid - the ID of the test case.

releaseid - the release ID.

Request format

To map a single test case to multiple requirements, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

Sample request

In this request, 10 is the requirement tree ID; 2 and 3 are requirement IDs.

Sample response

Map a single test case to requirements from multiple nodes

Use the following operation:

POST /flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

testcaseid - the ID of the test case.

releaseid - the release ID.

Request format

To map a single test case to requirements from multiple nodes, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

Sample request

In this request, 10 and 11 are requirement tree IDs. 4 and 7 are requirement IDs.

Sample response

Map multiple test cases to multiple requirements

Use the following operation:

POST /flex/services/rest/latest/testcase/allocate/requirement?releaseid={id}&tcrCatalogTreeId={id}

Request format

To map multiple test cases to multiple requirements, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/allocate/requirement?releaseid={id}&tcrCatalogTreeId={id}

releaseid - the release ID.

tcrCatalogTreeId - the ID of the tree where the test case resides.

Sample request

testcaseid - the ID of the test case.

10 and 11 are requirement tree IDs. 5 and 6 are requirement IDs.

Sample response

Map a single test case to the entire Requirements node

Use the following operation:

POST /flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

Request format

To map a single test case to the entire Requirements node, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/testcase/allocate/requirement/{testcaseid}?releaseid={id}

testcaseid - the ID of the test case.

releaseid - the ID of the release.

Sample request

In [11, 2], 2 is specified to map the entire node.

In [10, 0], 0 indicates that no requirement is mapped to the test case in the node with the ID 10.

Sample response

Synchronize requirements

Use the following operation to synchronize requirements in Zephyr Enterprise:

POST /flex/services/rest/latest/externalrequirement/importall?projectId={id}

projectId - the ID of the project.

Request format

To synchronize requirements, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/externalrequirement/importall?projectId={id}

Sample request

searchString - a Jira query for importing requirements.

Sample response

See Also

Migration REST API