Templates

Retrieving templates

To retrieve a list of templates from the developers.whispir.com API you can execute a HTTP GET using the /templates endpoint.

You need to supply one of the following headers (for retrieving JSON or XML):

  • Accept: application/vnd.whispir.template-v1+xml
  • Accept: application/vnd.whispir.template-v1+json

An array of message templates will be returned to you in the HTTP response body. Each template will provide the following information:

Response elements

messageTemplateName

String

Specifies the name of the message template to be used within message requests.

messageTemplateDescription

String

Specifies the description of the message template for others to understand its purpose.

id

String

Specifies the ID of the template that can be used for message sending.

link

Array

Provides a list of URLs that can be used to manipulate or access the message template.

  • uri: The link to access the message template.
  • rel: The descriptor for what the link will do.
  • method: The HTTP method to use with this particular link.
  • JSON
  • XML

Retrieving templates

The following API methods allow users to access templates via the API:

{{codeStart}}

HTTP 1.1 GET https://api.<region>.whispir.com/templates?apikey=[your_api_key]

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

Accept: application/vnd.whispir.template-v1+json

{

"status" : "1 to 4 of 4 ",

"messagetemplates" : [ {

"messageTemplateName" : "Appointment reminder",

"messageTemplateDescription" : "",

"id" : "F0547F6F2E4839F8",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/templates/F0547F6F2E4839F8?apikey=[your_api_key]",

"rel" : "self",

"method" : "GET"

} ]

}, {

"messageTemplateName" : "Customer survey",

"messageTemplateDescription" : "",

"id" : "DDE10AC13FB0E457",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/templates/DDE10AC13FB0E457?apikey=[your_api_key]",

"rel" : "self",

"method" : "GET"

} ]

}, {

"messageTemplateName" : "Service announcement",

"messageTemplateDescription" : "",

"id" : "900972D1C916FE84",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/templates/900972D1C916FE84?apikey=[your_api_key]",

"rel" : "self",

"method" : "GET"

} ]

}, {

"messageTemplateName" : "Shift opportunity",

"messageTemplateDescription" : "",

"id" : "9CB9BE20B885542D",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/templates/9CB9BE20B885542D?apikey=[your_api_key]",

"rel" : "self",

"method" : "GET"

} ]

} ],

"link" : [ ]

}

{{codeEnd}}