REST constraints
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 ID
- constrainable_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 element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — Occurs when the token is invalid
- ERROR 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:
An example of filters:
An example of filters with constraint:
An example of filters with governor:
GET /v1/constraints/[id]
Returns a constraint by the ID.
Common attributes
- id — Numerical unique ID for record
- format — Ensure to include an accept header or add .xml or .json to the last path element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — Occurs when the token is invalid
- ERROR 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:
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 element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — Occurs when the token is invalid
- ERROR 422 Unprocessable entity — Occurs when validation fails, objects and errors are returned
- ERROR 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:
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 element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — Occurs when the token is invalid
- ERROR 404 Not found — Occurs when record to update is not found
- ERROR 422 Unprocessable entity — Occurs when validation fails and objects and errors are returned
- ERROR 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:
DELETE /v1/constraints/[id]
Deletes a constraint.
Common attributes
- id — Numerical unique ID for record
- format — Ensure to include an accept header or add .xml or .json to the last path element
- token — Your API Token for authentication
Errors caused
- ERROR 403 Forbidden — Occurs when the token is invalid
- ERROR 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:
Sample output
The following JSON is a sample output from GET /v1/constraints:
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:
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>
Related topic