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
- 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)
Common attributes
- format — Ensure 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:
An example of filters:
GET /v1/procedures/[id]
Returns a procedure by ID.
Common attributes
- id — Unique numerical ID for a procedure
- format — Ensure 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 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/procedures
Creates a new procedure from posted data.
Required attribute
- name — String name of the procedure
Optional attributes
- 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 — Ensure 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 422 Unprocessable entity — Occurs when validation fails 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:
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
- 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 — 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
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 toggling the archive status of an object:
DELETE /v1/procedures/[id]
Deletes a procedure.
Common attributes
- id — Unique numerical ID of the procedure
- 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/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 a 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