REST runs
A run is an ordered collection of requests that can be executed serially or in parallel as a deployment activity. You can schedule multiple runs to be executed on different dates and at different times. A plan stage might require one or more runs to complete all the tasks for that stage.
GET /v1/runs
Returns all runs
Filters
- name — String for runs name
- aasm_state — String value for Acts as State Machine (aasm) state (created, planned, started, held, blocked, completed, cancelled, deleted)
- stage_id — Integer value for a related stage ID
- owner_id — Integer value for a related user ID in the role of owner
- requestor_id — Integer value for a related user ID in the role of requester
- started_at — Date-time string in Coordinated Universal Time, or UTC (for example, 2012-10-24 15:24:03 UTC) that returns any run scheduled to start that same day
- end_at — Date-time string in UTC (for example, 2012-10-24 15:24:03 UTC) that returns any run scheduled to finish that same day
- time — Date-time string in UTC (for example, 2012-10-24 15:24:03 UTC) falling between run start and end dates, inclusive
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:
GET /v1/runs/[id]
Returns a run by 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/runs
Creates a new run from posted data
Required attributes
- name — String name of the run
- owner_id — ID of user that owns the run
- plan_id — ID of related plan
- plan_stage_id — ID of related plan_stage
- requestor_id — ID of user that requested the run
Optional attributes
- description — String value for the description of the run
- duration — Integer value for the duration
- end_at_date — Alternate simple string accessors for setting the time data
- end_at_hour — Alternate simple string accessors for setting the time data
- end_at_meridian — Alternate simple string accessors for setting the time data (AM or PM)
- end_at_minute — Alternate simple string accessors for setting the time data
- end_at — Date-time value for the run end
- start_at_date — Alternate simple string accessors for setting the time data
- start_at_hour — Alternate simple string accessors for setting the time data
- start_at_meridian — Alternate simple string accessors for setting the time data (AM or PM)
- start_at_minute — Alternate simple string accessors for setting the time data
- start_at — Date-time value for the run start
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
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/runs/[id]
Updates an existing run with values from a posted document
Editable attributes
- name — String name of the run
- owner_id — ID of user that owns the run
- plan_id — ID of related plan
- plan_stage_id — ID of related plan_stage
- requestor_id — ID of user that requested the run
- description — String value for the description of the run
- duration — Integer value for the duration
- end_at_date — Alternate simple string accessors for setting the time data
- end_at_hour — Alternate simple string accessors for setting the time data
- end_at_meridian — Alternate simple string accessors for setting the time data (AM or PM)
- end_at_minute — Alternate simple string accessors for setting the time data
- end_at — Date-time value for the run end
- start_at_date — Alternate simple string accessors for setting the time data
- start_at_hour — Alternate simple string accessors for setting the time data
- start_at_meridian — Alternate simple string accessors for setting the time data (AM or PM)
- start_at_minute — Alternate simple string accessors for setting the time data
- start_at — Date-time value for the run start
State machine events
- aasm_event — Can be submitted to transition a run to the next state. Supported events: plan_it, start, hold, block, cancel, complete, delete.
Toggle archival status
- toggle_archive — Boolean value that will toggle 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, 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:
An example of starting a run using the state machine:
DELETE /v1/runs/[id]
Deletes a run.
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/runs:
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "780b255cc0a19530c3425a737799d5d1"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: a15b2dbd4bd0f27cdcfe2cba34a8d8a3
X-Runtime: 0.072000
Content-Type: application/json;charset=utf-8
Content-Length: 462
Date: Fri, 08 Feb 2013 16:32:54 GMT
[{
"aasm_state": "created",
"created_at": "2013-02-08T11:17:45-05:00",
"description": null,
"duration": null,
"end_at": null,
"id": 1,
"name": "Sample Run",
"owner_id": 1,
"plan_id": 1,
"plan_stage_id": 1,
"requestor_id": 1,
"start_at": null,
"updated_at": "2013-02-08T11:17:45-05:00",
"plan": {
"aasm_state": "created",
"id": 1,
"name": "Sample Plan"
},
"plan_stage": {
"id": 1,
"name": "uat"
},
"plan_members": [{
"id": 1,
"position": 1,
"request": {
"aasm_state": "created",
"id": 3,
"name": "Sample Request 2"
}
}]
}]
The following XML is a sample output from GET /v1/runs/1:
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "f954e84ef179588e8bc37dbcccd18a71"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: f24be9bedeee2e8a0f3140c0c0352fd1
X-Runtime: 0.143000
Content-Type: application/json;charset=utf-8
Content-Length: 460
Date: Fri, 08 Feb 2013 17:53:20 GMT
{
"aasm_state": "created",
"created_at": "2013-02-08T11:17:45-05:00",
"description": null,
"duration": null,
"end_at": null,
"id": 1,
"name": "Sample Run",
"owner_id": 1,
"plan_id": 1,
"plan_stage_id": 1,
"requestor_id": 1,
"start_at": null,
"updated_at": "2013-02-08T11:17:45-05:00",
"plan": {
"aasm_state": "created",
"id": 1,
"name": "Sample Plan"
},
"plan_stage": {
"id": 1,
"name": "uat"
},
"plan_members": [{
"id": 1,
"position": 1,
"request": {
"aasm_state": "created",
"id": 3,
"name": "Sample Request 2"
}
}]
}
Related topic