Page tree

Notification templates are user-customizable email templates used by the notification systems for request, step, and system events. Templates use the Liquid template framework to allow tokenized values.

GET /v1/notification_templates

Returns all notification_templates.

Filters

  • title — String for notification_templates title
  • active — Boolean value to show active templates
  • inactive — Boolean value for inactive templates

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:

curl -i -H "accept: text/xml" -X GET http://[rails_host]/v1/notification_templates?token=[api_token]
curl -i -H "accept: application/json" -X GET http://[rails_host]/v1/notification_templates?token=[api_token]

An example of filters:

curl -i -H "accept: application/json" -H "Content-type: application/json" -X GET -d '{ "filters": { "title":"Exception Raised" } }' http://[rails_host]/v1/notification_templates?token=[api_token]

GET /v1/notification_templates/[id]

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

curl -i -H "accept: text/xml" -X GET http://[rails_host]/v1/notification_templates/[id]?token=[api_token]
curl -i -H "accept: application/json" -X GET http://[rails_host]/v1/notification_templates/[id]?token=[api_token]

POST /v1/notification_templates

Creates a new notification template from posted data.

Required Attributes

  • title — String title of the notification_template
  • event— String event for notification template with acceptable values:
    • exception_raised
    • request_message
    • request_completed
    • request_cancelled
    • request_in_problem

    • request_on_hold

    • request_planned

    • request_resolved

    • request_started

    • step_started
    • step_ready
    • step_completed
    • step_blocked
    • step_problem
    • user_created
    • password_reset
    • password_changed
    • login
    • user_admin_created
  • format — String format for notification_template (required, one of text/plain, text/enriched, text/html)
  • body — Text of the message in Liquid template format (required)

Optional Attributes

  • description — String description of the notification template

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 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:

curl -i -H "accept: application/json" -H "Content-type: application/json"  -X POST -d '<notification_template><title>JSON Template</title><format>text/html</format><event>exception_raised</event><body>An exception has occurred.</body></notification_template>' http://[rails_host]/v1/notification_templates?token=[api_token]
curl -i -H "accept: application/json" -H "Content-type: application/json"  -X POST -d '{ "notification_template": { "title":"JSON Template", "format":"text/html", "event":"exception_raised", "body":"An exception has occurred." }}' http://[rails_host]/v1/notification_templates/?token=[api_token]

PUT /v1/notification_templates/[id]

Updates an existing notification_template with values from a posted document.

Editable Attributes

  • title — String title of the notification_template (required, unique)
  • event— String event for notification_template (required); acceptable values include:
    • exception_raised
    • request_message
    • request_completed
    • request_cancelled
    • request_in_problem

    • request_on_hold

    • request_planned

    • request_resolved

    • request_started

    • step_started
    • step_ready
    • step_completed
    • step_blocked
    • step_problem
    • user_created
    • password_reset
    • password_changed
    • login
    • user_admin_created
  • format — String format for notification_template (one of text/plain, text/enriched, text/html)
  • body — Text of the message in liquid template format
  • description — String description of the notification template

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:

curl -i -H "accept: text/xml" -H "Content-type: text/xml" -X PUT -d '<notification_template><name>Renamed Notification Template</name></notification_template>' http://[rails_host]/v1/notification_templates/[id]?token=[api_token]
curl -i -H "accept: application/json" -H "Content-type: application/json" -X PUT -d '{ "notification_template": { "name" : "Renamed Notification Template"}}'  http://[rails_host]/v1/notification_templates/[id]?token=[api_token]

DELETE /v1/notification_templates/[id] 

Makes a notification template inactive. Sets the active parameter for the notification template to false.

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:

curl -i -H "accept: text/xml" -X DELETE http://[rails_host]/v1/notification_templates/[id]?token=[api_token]
curl -i -H "accept: application/json" -X DELETE http://[rails_host]/v1/notification_templates/[id]?token=[api_token]

Sample output

The following JSON is a sample output from GET /v1/notification_templates:

HTTP / 1.1 200 OK
Server: Apache - Coyote / 1.1
X - UA - Compatible: IE = Edge
ETag: "c9d636cf8d221dde77d0a1e14d401a1b"
Cache - Control: max - age = 0,
private,
must - revalidate
X - Request - Id: bf76331f81cc0a81dfbc43fd5af7162a
X - Runtime: 0.435000
Content - Type: application / json;
charset = utf - 8
Transfer - Encoding: chunked
Date: Tue,
23 Oct 2012 20: 47: 50 GMT

[{
	"active": true,
	"body": "<p>The following exception was raised at {{params.SS_company_name}}:</p> <br/>\n{% if params.SS_exception_message %}\n<p><strong>Message:</strong></p>\n<p>{{params.SS_exception_message}}</p>\n{% endif %}\n{% if params.SS_exception_backtrace %}\n<p><strong>Backtrace:</strong></p>\n<p>{{params.SS_exception_backtrace}}</p>\n{% endif %}\n<p>LOGGING IN TO BMC RELEASE PROCESS MANAGEMENT<br />\n  ==============================<br />\n  {{ params.SS_login_url }}<br />\n</p>\n\n",
	"created_at": "2012-02-28T16:12:23-05:00",
	"description": "A system notification for application exceptions.",
	"event": "exception_raised",
	"format": "text/html",
	"id": 1,
	"subject": "Exception raised at {{params.SS_company_name}}",
	"title": "Exception Raised",
	"updated_at": "2012-02-28T16:12:23-05:00"
}]

The following XML is a sample output from GET /v1/notification_templates/1:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-UA-Compatible: IE=Edge
ETag: "3ca7c183df80a59700b56f1868511bab"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 30636053d3f3068a4844b219f715a6d5
X-Runtime: 0.146000
Content-Type: application/xml;charset=utf-8
Content-Length: 1133
Date: Tue, 23 Oct 2012 20:50:32 GMT

<?xml version="1.0" encoding="UTF-8"?>
<notification-template>
  <active type="boolean">true</active>
  <body>&lt;p&gt;The following exception was raised at {{params.SS_company_name}}:&lt;/p&gt; &lt;br/&gt;
{% if params.SS_exception_message %}
&lt;p&gt;&lt;strong&gt;Message:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;{{params.SS_exception_message}}&lt;/p&gt;
{% endif %}
{% if params.SS_exception_backtrace %}
&lt;p&gt;&lt;strong&gt;Backtrace:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;{{params.SS_exception_backtrace}}&lt;/p&gt;
{% endif %}
&lt;p&gt;LOGGING IN TO BMC RELEASE PROCESS MANAGEMENT&lt;br /&gt;
  ==============================&lt;br /&gt;
  {{ params.SS_login_url }}&lt;br /&gt;
&lt;/p&gt;

</body>
  <created-at type="datetime">2012-02-28T16:12:23-05:00</created-at>
  <description>A system notification for application exceptions.</description>
  <event>exception_raised</event>
  <format>text/html</format>
  <id type="integer">1</id>
  <subject>Exception raised at {{params.SS_company_name}}</subject>
  <title>Exception Raised</title>
  <updated-at type="datetime">2012-02-28T16:12:23-05:00</updated-at>
</notification-template>

Related topic

Managing requests