REST plan stage instances


Plan stage instances are plan stages that are used in plans and define the primary gateways an application has to pass through in order to be successfully deployed. While these often have the same names as environments in BMC Release Process Management (RPM), they are distinct in order to allow environments to be scaled (dev1, dev2, dev3 ) or temporarily borrowed and assigned to a differently named stage such as when a QA environment is borrowed for work in the development stage for a diagnostic routine.

NoteThe include_except and alone filters are available in only 5.0.03.004 and later versions of RPM. Use these filters to limit the data in API response and hence, reduce the API response time.

GET /v1/plan_stage_instances

Returns all 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)
  • include_except—Comma-separated strings of the top-level associated items to exclude from the response. You can remove only top-level associated items from the response and these associated items should be a collection (zero to many) of other objects (not a simple property—string, numeric, boolean, and so on). For example, you can remove components from an application but you cannot remove route gates (it is not a top-level associated item) or app_version (it is a simple property). If you provide an incorrect associated item name (for example, the associated item does not exist, is not at the top level, or is a property), the name is ignored. See the table below for the items and their associated items.
  • alone—Boolean value to return only the item or the associated items as well along with the item. If set to false (default), item and associated item details are returned; if set to true, only item details are returned. See the table below for the items and their associated items. See the table below for the items and their associated items.

Item

Associated items

plan_stage_instances

plan, plan_stage,
constraints

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 the 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]

Examples with 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]

To get a filtered list of plan stages and constraints:

curl -i -H "accept: application/json" -H "Content-type: application/json" -d '{ "filters": { "include_except":"plan_stage, constraints" }}' -X GET https://[rails_host]/v1/plan_stage_instances?token=[api_token]

GET /v1/plan_stage_instances/[id]

Returns a 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

Filters

  • include_except—Comma-separated strings of the top-level associated items to exclude from the response. You can remove only top-level associated items from the response and these associated items should be a collection (zero to many) of other objects (not a simple property—string, numeric, boolean, and so on). For example, you can remove components from an application but you cannot remove route gates (it is not a top-level associated item) or app_version (it is a simple property). If you provide an incorrect associated item name (for example, the associated item does not exist, is not at the top level, or is a property), the name is ignored. See the table below for the items and their associated items.
  • alone—Boolean value to return only the item or the associated items as well along with the item. If set to false (default), item and associated item details are returned; if set to true, only item details are returned. See the table below for the items and their associated items. See the table below for the items and their associated items.

Item

Associated items

plan_stage_instances

plan, plan_stage,
constraints

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]

Filter example:

curl -i -H "accept: application/json" -H "Content-type: application/json" -X GET -d '{ "filters": { "include_except":"plan_stage, constraints" }}' https://[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:

<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-version-1

 

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