REST constraints - Documentation for BMC Release Process Management 5.0.07
GET /v1/constraints
Returns all the constraints (unarchived by default).
Filters
constraint— Complex filter by constraint (by ID and type; only supported type is ‘RouteGate’). See sample below.governor— Complex filter by governor (by ID and type; only supported type is ‘PlanStageInstance). See sample below.route_id— Integer for route IDconstrainable_type– String for constrainable type (currently only ‘RouteGate’ supported)active— Boolean value for showing active (on by default, can be combined with inactive to show both)inactive— Boolean value for showing inactive (can be combined with active to show both)
Common attributes
format— Ensure to include an accept header or add .xml or .json to the last path elementtoken— Your API Token for authentication
Errors caused
ERROR 403 Forbidden— Occurs when the token is invalidERROR 404 Not Found— Occurs when no records are found
Examples
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
curl -i -H "accept: text/xml" -X GET curl -i -H "accept: application/json" -X GET An example of filters:
curl -i -H "accept: application/json" -H "Content-type: application/json" -X GET -d '{ "filters": { "name":"Dev" } }' An example of filters with constraint:
curl -i -H "accept: application/json" -H "Content-type: application/json" -X GET -d '{ "filters": { "constraint": { "id":1, "type":"RouteGate" } } }' An example of filters with governor:
curl -i -H "accept: text/xml" -H "Content-type: text/xml" -X GET -d '<filters><governor><id>1</id><type>PlanStageInstance</type></governor></filters>' GET /v1/constraints/[id]
Returns a constraint by the ID.
Common attributes
id— Numerical unique ID for recordformat— Ensure to include an accept header or add .xml or .json to the last path elementtoken— Your API Token for authentication
Errors caused
ERROR 403 Forbidden— Occurs when the token is invalidERROR 404 Not found— Occurs when record to show is not found
Examples
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
curl -i -H "accept: text/xml" -X GET curl -i -H "accept: application/json" -X GET POST /v1/constraints
Creates a new constraint from the posted data.
Required attributes
constrainable_id— Integer for constrainable ID (currently route gate ID)constrainable_type— String for constrainable type (currently only ‘RouteGate’ supported)governable_id– Integer for governable ID (currently plan stage instance ID)governable_type— String for governable type (currently only ‘PlanStageInstance’ supported)
Optional attributes
active– Boolean value that indicate if constraint active or not
Common attributes
format— Ensure to include an accept header or add xml or .json to the last path elementtoken— Your API Token for authentication
Errors caused
ERROR 403 Forbidden— Occurs when the token is invalidERROR 422 Unprocessable entity— Occurs when validation fails, objects and errors are returnedERROR 500 Internal Server Error — Occurs when server error(s) occurred, , objects and errors are returned
Examples
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
curl -i -H "accept: text/xml" -H "Content-type: text/xml" -X POST -d '<constraint><constrainable_id>1</constrainable_id><constrainable_type>RouteGate</constrainable_type <governable_id>1</governable_id><governable_type>PlanStageInstance</governable_type></constraint>' curl -i -H "accept: application/json" -H "Content-type: application/json" -X POST -d '{"constraint": { "constrainable_id":1, "constrainable_type":"RouteGate", "governable_id":1, "governable_type":"PlanStageInstance" }}' PUT /v1/constraints/[id]
Updates an existing constraint with values from the posted document
Editable attributes
constrainable_id— Integer for constrainable ID (currently route gate ID)constrainable_type— String for constrainable type (currently only ‘RouteGate’ supported)governable_id– Integer for governable ID (currently plan stage instance ID)governable_type— String for governable type (currently only ‘PlanStageInstance’ supported)active— Boolean value that indicate if constraint active or not
Common attributes
format— Ensure to include an accept header or add .xml or .json to the last path elementtoken— Your API Token for authentication
Errors caused
ERROR 403 Forbidden— Occurs when the token is invalidERROR 404 Not found— Occurs when record to update is not foundERROR 422 Unprocessable entity— Occurs when validation fails and objects and errors are returnedERROR 500 Internal Server Error— Occurs when server error(s) occurred and objects and errors are returned.
Examples
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
curl -i -H "accept: text/xml" -H "Content-type: text/xml" -X PUT -d '<constraint><active>false</active></constraint>' curl -i -H "accept: application/json" -H "Content-type: application/json" -X PUT -d '{ "constraint": { "active" : false }}' DELETE /v1/constraints/[id]
Deletes a constraint.
Common attributes
id— Numerical unique ID for recordformat— Ensure to include an accept header or add .xml or .json to the last path elementtoken— Your API Token for authentication
Errors caused
ERROR 403 Forbidden— Occurs when the token is invalidERROR 404 Not found— Occurs when no records are found
Examples
To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:
curl -i -H "accept: text/xml" -X DELETE curl -i -H "accept: application/json" -X DELETE Sample output
The following JSON is a sample output from GET /v1/constraints:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "e12d69a32321c0ee192b2167a7cf5c35"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 608c06b24ba5ff4127ca86b7da6647c5
X-Runtime: 1.575000
Content-Type: application/json;charset=utf-8
Content-Length: 969
Date: Fri, 23 Aug 2013 12:52:50 GMT
[{ "active":true, "constrainable_id":3, "constrainable_type":"RouteGate", "created_at":"2013-08-23T12:26:52-04:00", "governable_id":3, "governable_type":"PlanStageInstance", "id":1, updated_at":"2013-08-23T12:26:52-04:00"
}, { "active":true, "constrainable_id":3, "constrainable_type":"RouteGate", "created_at":"2013-08-23T12:27:50-04:00", "governable_id":2, "governable_type":"PlanStageInstance", "id":3, "updated_at":"2013-08-23T12:27:50-04:00"
}, { "active":true, "constrainable_id":2, "constrainable_type":"RouteGate", "created_at":"2013-08-23T12:27:55-04:00", "governable_id":1, "governable_type":"PlanStageInstance", "id":4, "updated_at":"2013-08-23T12:27:55-04:00"
}, { "active":true, "constrainable_id":2, "constrainable_type":"RouteGate", "created_at":"2013-08-23T12:28:01-04:00", "governable_id":2, "governable_type":"PlanStageInstance", "id":5, "updated_at":"2013-08-23T12:28:01-04:00"
}]The following XML is a sample output from GET /v1/constraints/1:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "77deefc8e8767bb6b7c635bbab0bdab2"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 397d5f0810e1408e5dd8c17240c8fd36
X-Runtime: 0.882000
Content-Type: application/xml;charset=utf-8
Content-Length: 498
Date: Fri, 23 Aug 2013 12:54:15 GMT
<?xml version="1.0" encoding="UTF-8"?>
<constraint> <active type="boolean">true</active> <constrainable-id type="integer">2</constrainable-id> <constrainable-type>RouteGate</constrainable-type> <created-at type="datetime">2013-08-23T12:27:55-04:00</created-at> <governable-id type="integer">1</governable-id> <governable-type>PlanStageInstance</governable-type> <id type="integer">4</id> <updated-at type="datetime">2013-08-23T12:27:55-04:00</updated-at>
</constraint>