REST plan stage instances


GET /v1/plan_stage_instances

Returns all the plan stage instances (unarchived by default).

Filters

  • plan_id — Integer for plan ID
  • plan_stage_id — Integer for plan stage ID
  • archived — Boolean value for showing archived (can be combined with unarchived to show both)
  • unarchived — Boolean value for showing unarchived (on by default, can be combined with archived 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:

curl -i -H "accept: text/xml" -X GET http://[rails_host]/v1/plan_stage_instances?token=[api_token]
curl -i -H "accept: application/json" -X GET http://[rails_host]/v1/plan_stage_instances?token=[api_token]

An example of filters:

curl -i -H "accept: application/json" -H "Content-type: application/json" -X GET -d '{ "filters": { "plan_id":1 } }' http://[rails_host]/v1/plan_stage_instances?token=[api_token]

GET /v1/plan_stage_instances/[id]

Returns an plan stage instance 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:

curl -i -H "accept: text/xml" -X GET http://[rails_host]/v1/plan_stage_instances/[id]?token=[api_token]
curl -i -H "accept: application/json" -X GET http://[rails_host]/v1/plan_stage_instances/[id]?token=[api_token]

POST /v1/plan_stage_instances

This method is not allowed for plan stage instances.

Errors caused

  • ERROR 403 Forbidden — Occurs when the token is invalid
  • ERROR 405 Method not allowed — Occurs when the method is not allowed

PUT /v1/ plan_stage_instances/[id]

This method is not allowed for plan stage instances.

Errors caused

  • ERROR 403 Forbidden — Occurs when the token is invalid
  • ERROR 405 Method not allowed — This method is not allowed.

DELETE /v1/plan_stage_instances/[id]

This method is not allowed for plan stage instances.

Errors caused

  • ERROR 403 Forbidden — Occurs when the token is invalid
  • ERROR 405 Method not allowed — This method is not allowed

Sample output

The following JSON is a sample output from GET /v1/plan_stage_instances:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
Etag: "89dd920a9eacd3994f6b0c56d0b09bd0"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 1d48afcff7d14de99205efa74b31eb78
X-Runtime: 1.575000
Content-Type: application/json;charset=utf-8
Content-Length: 622
Date: Tue, 27 Aug 2013 19:18:50 GMT

[{
     "aasm_state":"compliant",
     "archive_number":null,
     "archived_at":null,
     "created_at":"2013-08-23T12:23:43-04:00",
     "id":1,
     "updated_at":"2013-08-23T12:23:43-04:00",
     "constraint_violations":[],
     "plan": {
           "id":1,
           "name":"Plan #1",
           "plan_template": {
                 "id":1,
                 "name":"Plan Template #1 (CI)"
            }
     },
     "plan_stage": {
           "id":1,
           "name":"Dev",
           "plan_template": {
                 "id":1,
                 "name":"Plan Template #1 (CI)"
            },
           "environment_type": {
                 "id":2,
                 "name":"Development"
            }
     },
     "constraints": [{
           "constrainable_id":2,
           "constrainable_type":"RouteGate",
           "id":4
      }]
}]

The following XML is a sample output from GET /v1/plan_stage_instances/1:

<?xml version="1.0" encoding="UTF-8"?>
<plan-stage-instance>
<aasm-state>compliant</aasm-state>
<archive-number nil="true"></archive-number>
<archived-at type="datetime" nil="true"></archived-at>
<created-at type="datetime">2013-08-23T12:23:43-04:00</created-at>
<id type="integer">1</id>
<updated-at type="datetime">2013-08-23T12:23:43-04:00</updated-at>
<constraint-violations type="array"/>
<plan>
   <id type="integer">1</id>   
<name>Plan #1</name>   
<plan-template>    
 <id type="integer">1</id>     
 <name>Plan Template #1 (CI)</name>   
</plan-template>
</plan>
<plan-stage>
   <id type="integer">1</id>   
<name>Dev</name>   
<plan-template>    
 <id type="integer">1</id>    
 <name>Plan Template #1 (CI)</name>  
</plan-template>  
<environment-type>    
 <id type="integer">2</id>    
 <name>Development</name>   
 </environment-type>
</plan-stage>
<constraints type="array">  
 <constraint>
<constrainable-id type="integer">2</constrainable-id>
<constrainable-type>RouteGate</constrainable-type>
<id type="integer">4</id>
 </constraint>
</constraints>
</plan-stage-instance>

Related topic

REST-API-commands

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*