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

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

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": 7,
  "name": "Untitled requirement",
  "details": "requirement details",
  "createdBy": 1,
  "lastModifiedBy": 1,
  "requirementType": 0,
  "testcaseIds": [],
  "releaseIds": [
    1
  ],
  "customProperties": null
}

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

Response body

{
  "customProperties" : { },
  "customProcessedProperties" : { },
  "id" : 1,
  "requirementTreeId" : 7,
  "name" : "Untitled requirement",
  "details" : "requirement details",
  "createdOn" : 1594991430176,
  "reqCreationDate" : "07/17/2020",
  "createdBy" : 1,
  "lastModifiedBy" : 1,
  "lastModifiedOn" : 1594991430206,
  "createDatetime" : 1594991430195,
  "requirementType" : 0,
  "testcaseIds" : [ ],
  "testcaseVersionIds" : [ ],
  "releaseIds" : [ 1 ],
  "requirementTreeIds" : [ 7, 9 ],
  "requirementReleaseTestcaseCountMapping" : [ ],
  "projectId" : 1,
  "customFieldProcessed" : false,
  "customFieldValues" : [ ],
  "releaseNames" : [ ],
  "isBddSupported" : false,
  "actualTestcaseIds" : [ ]
}

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

{
  "attachmentCount": 0,
  "actualTestcaseIds": [],
  "requirementTreeId": 7,
  "name": "Updated Requirement",
  "details": "requirement details",
  "externalId": "AltId:1",
  "url": "http://localhost/",
  "priority": 1,
  "id": 1,
  "releaseIds": [
    "1"
  ],
  "customProperties": {},
  "customProcessedProperties": {},
  "createdBy": 1,
  "createdOn": 1594924200000,
  "reqCreationDate": "07/17/2020",
  "testcaseIds": [],
  "requirementType": 0,
  "requirementReleaseTestcaseCountMapping": [],
  "projectId": 1
}

Sample response

1

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

{
  "projectId": 1,
  "importExternalRequirementDTO": {
    "projectId": 1,
    "topFolderName": "",
    "jiraSync": true
  },
  "searchStringDTO": {
    "searchString": "Project = \"zs-development\""
  },
  "filterSearch": false,
  "filterName": "",
  "filterId": null,
  "jiraSyncId": "",
  "releaseId": "1",
  "bugs": [],
  "importAll": true
}

searchString - a Jira query for importing requirements.

Sample response

Successfully imported total 19 requirements 

See Also

Migration REST API

Publication date: