REST procedures
Procedures are collections of steps that you can reuse in multiple requests and associate with applications.
GET /v1/procedures
Returns all procedures.
Filters
object_states—String name of a valid status of the object state
- name—String for the procedure name
- app_id—Integer for the related application ID
- archived—Boolean value for showing the archived status (can be combined with unarchived to show both)
- unarchived—Boolean value for showing the unarchived status (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 |
---|---|
procedures | steps |
Common attributes
- format—Be sure to include this as 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:
The following examples show filters:
GET /v1/procedures/[id]
Returns a procedure by ID.
Common attributes
- id—Unique numerical ID for a procedure
- format—Be sure to include this as 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 |
---|---|
procedures | steps |
Errors caused
- ERROR 403 Forbidden—Occurs when the token is invalid
- ERROR 404 Not found—Occurs when the 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:
Filter example:
POST /v1/procedures
Creates a new procedure from posted data.
Required attribute
- name—String name of the procedure
Optional attributes
aasm_state—String name of a valid status of object state
- description—String description of the procedure
- app_ids—Array of integer values for the related application IDs
step_ids—Array of integer values for the related step IDs
step_ids_to_clone—Array of integer related step IDs to be cloned and associated with the procedure. Fields to be cloned are controlled by the metadata list titled IncludeInSteps
Common attributes
- format—Be sure to include this as 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 |
---|---|
procedures | steps |
Errors caused
- ERROR 403 Forbidden—Occurs when the token is invalid
- ERROR 422 Unprocessable entity—Occurs when validation fails; 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:
Filter example:
PUT /v1/procedures/[id]
Updates an existing procedure with values from a posted document.
Editable attributes
- name—String name of the procedure
- description—String description of the procedure
aasm_state—String name of a valid status of object state
- app_ids—Array of integer values for the related application IDs
step_ids—Array of integer values for the related step IDs
step_ids_to_clone—Array of integer related step IDs to be cloned and associated with the procedure. Fields to be cloned are controlled by the metadata list titled IncludeInSteps
Toggle archival status
toggle_archive—Boolean value that toggles the archive status of an object
Common attributes
- format—Be sure 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 |
---|---|
procedures | steps |
Errors caused
- ERROR 403 Forbidden—Occurs when the token is invalid
- ERROR 404 Not found—Occurs when the record to update is not found
- ERROR 422 Unprocessable entity—Occurs when validation fails; 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:
The following example toggles the archive status of an object:
Filter example:
DELETE /v1/procedures/[id]
Deletes a procedure.
Common attributes
- id—Unique numerical ID of the procedure
- format—Be sure 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 sample output from GET /v1/procedures:
"archive_number": null,
"archived_at": null,
"created_at": "2012-08-29T21:41:02-04:00",
"description": "Steps from request #1001",
"id": 1,
"name": "Sample Procedure",
"updated_at": "2012-08-29T21:41:02-04:00",
"steps": [{
"aasm_state": "locked",
"id": 8,
"name": "Step 1"
}, {
"aasm_state": "locked",
"id": 9,
"name": "Step 2"
}, {
"aasm_state": "locked",
"id": 10,
"name": "Step 3"
}, {
"aasm_state": "locked",
"id": 11,
"name": "Step 2"
}, {
"aasm_state": "locked",
"id": 12,
"name": "Step 4"
}, {
"aasm_state": "locked",
"id": 13,
"name": "Step 7"
}]
}]
The following XML is sample output from GET /v1/procedures/1:
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "c9ff133fb107fb979f3b1002e8c69afe"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 3aab000dde7aa338dc5ba841145dd885
X-Runtime: 0.167000
Content-Type: application/xml;charset=utf-8
Content-Length: 1172
Date: Thu, 30 Aug 2012 02:16:37 GMT
<?xml version="1.0" encoding="UTF-8"?>
<procedure>
<archive-number nil="true"></archive-number>
<archived-at type="datetime" nil="true"></archived-at>
<created-at type="datetime">2012-08-29T21:41:02-04:00</created-at>
<description>Steps from request #1001</description>
<id type="integer">1</id>
<name>Sample Procedure</name>
<updated-at type="datetime">2012-08-29T21:41:02-04:00</updated-at>
<steps type="array">
<step>
<aasm-state>locked</aasm-state>
<id type="integer">8</id>
<name>Step 1</name>
</step>
<step>
<aasm-state>locked</aasm-state>
<id type="integer">9</id>
<name>Step 2</name>
</step>
<step>
<aasm-state>locked</aasm-state>
<id type="integer">10</id>
<name>Step 3</name>
</step>
<step>
<aasm-state>locked</aasm-state>
<id type="integer">11</id>
<name>Step 2</name>
</step>
<step>
<aasm-state>locked</aasm-state>
<id type="integer">12</id>
<name>Step 4</name>
</step>
<step>
<aasm-state>locked</aasm-state>
<id type="integer">13</id>
<name>Step 7</name>
</step>
</steps>
</procedure>
Related topic