You can manage (i.e., create, update, delete) Pre-Conditions directly through Jira's native REST API.
The Xray REST API provides the following endpoints.
Pre-Condition Tests
To view the Test associated with a Pre-Condition you need to specify the key of the Pre-Condition you wish to view.
To associate or remove a Test from a Pre-Condition, you need to send a JSON with a list of the Test keys.
To remove a Test from a Pre-Condition you need to specify the keyof the Test you wish to remove.
Expand |
---|
title | GET /rest/raven/1.0/api/precondition/{preConditionKey}/test |
---|
|
Panel |
---|
borderColor | #ccc |
---|
borderStyle | solid |
---|
| Return a json with a list of the test associated with the pre-condition. Request PATH PARAMETERS parameter | type | description |
---|
preConditionKey | String | - key of the pre-condition. |
Tip |
---|
| curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver/rest/raven/1.0/api/precondition/TEST-123/test |
Responses 200 OK : text/plain : Successful. Return a json. Code Block |
---|
| [{
key: "TEST-1",
self: "http://localhost:6080/rest/api/2/issue/19701",
reporter: "admin",
precondition: [{
preconditionKey: "TEST-4",
self: "http://localhost:6080/rest/api/2/issue/19705",
reporter: "admin",
type: "Cucumber"
}],
type: "Cucumber"
}, {
key: "TEST-2",
self: "http://localhost:6080/rest/api/2/issue/19701",
reporter: "admin",
precondition: [{
preconditionKey: "TEST-4",
self: "http://localhost:6080/rest/api/2/issue/19705",
reporter: "admin",
type: "Cucumber"
}],
type: "Cucumber"
}] |
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 getting the tests. |
|
Expand |
---|
title | POST /rest/raven/1.0/api/precondition/{preConditionKey}/test |
---|
|
Panel |
---|
borderColor | #ccc |
---|
borderStyle | solid |
---|
| Associate tests with the pre-condition. Return error messages, if there are any. Request PATH PARAMETERS parameter | type | description |
---|
preConditionKey | String | - key of the pre-condition. |
Example Code Block |
---|
| {
"add": [
"CALC-14",
"CALC-29"
],
"remove": [
"CALC-15",
"CALC-50"
]
} |
Tip |
---|
| curl -H "Content-Type: application/json" -X POST -u admin:admin --data @example.json http://yourserver/rest/raven/1.0/api/precondition/TEST-123/test |
Responses 200 OK : text/plain : Successful. Returns error messages if there are any. Code Block |
---|
| ["Test with key TEST-3 was not associated with Pre-Condition with key TEST-4.","Test with key TEST-2 was already associated with Pre-Condition with key TEST-4."] |
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. |
|
Expand |
---|
title | DELETE /rest/raven/1.0/api/precondition/{preConditionKey}/test/{testKey} |
---|
|
Panel |
---|
borderColor | #ccc |
---|
borderStyle | solid |
---|
| Remove a test from the pre-condition. Request PATH PARAMETERS parameter | type | description |
---|
preConditionKey | String | - key of the pre-condition. | testKey | String | - key of the test. |
Tip |
---|
| curl -H "Content-Type: application/json" -X DELETE -u admin:admin http://yourserver/rest/raven/1.0/api/precondition/TEST-123/test/TEST-321 |
Responses 200 OK : text/plain : Successful. 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 removing the test. |
|