REST v.2 request templates


Request templates are a companion model to requests that allow new requests to be created based on the structure and contents of an original request. When a request template is made in the user interface from an existing request, the request is first copied into a new invisible request. A request template model is then added that refers to that source request and provides the methods needed for cloning the source request under various conditions.

GET /v2/request_templates

Returns request templates that are not archived and to which you have access.

Filters

  • app_id—Integer ID of the application to which the source request was originally associated
  • archived—Boolean value to show archived request templates (it can be combined with the unarchived to show both)
  • environment_id—Integer ID of the environment to which the source request was originally associated
  • object_states— String name of a valid status of the object state  

    Note

    Valid status of object states are draft, pending, released, retired, and archived_state (or any combination separated with ',' or ', '). The default object state is draft.

  • parent_id—Integer ID of the request template used to create a sibling or request template variant
  • unarchived—Boolean value to show unarchived request templates (it can be combined with the archived to show both)

Common attributes

  • format—Be sure to include an accept header or add 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 the URL or your valid API key and application host into a browser or HTTP client like Wget or cURL.

To get a list of all request templates, run the following REST call:

curl -i -H "accept: application/json" -H "Content-type: application/json" -X GET http://[rails_host]/v2/request_templates?token=[api_token]

Examples with filters

To get a list of request templates associated with a specific application, run the following REST call:

curl -i -H "accept: application/json" -H "Content-type: application/json"  -X GET -d '{ "filters": { "app_id":2}}' http://[rails_host]/v2/request_templates?token=[api_token]

To get a list of the Released request templates associated with a specific application, run the following REST call:

curl -i -H "accept: application/json" -H "Content-type: application/json"  -X GET -d '{ "filters": { "app_id":2, "object_states":"released"}}' http://[rails_host]/v2/request_templates?token=[api_token]

Related topics

Managing-requests

 

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