Callbacks

Retrieving callbacks

To retrieve a list of callbacks from the Whispir API you can execute a HTTP GET using the /callbacks endpoint.

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

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

An array of callbacks will be returned to you in the HTTP response body. Each callback will provide the following information:

Response elements

id

String

The unique ID of the callback within Whispir.

name

String

The name given to the callback at creation time. Also the ID that is used in the /messages endpoint.

url

String

The application URL that was given to the callback at creation time. Also the endpoint that will be used when supplying callback information.

link

Array

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

  • uri: The link to access the specific callback.
  • rel: The descriptor for what the link will do.
  • method: The HTTP method to use with this particular link.

  • JSON
  • XML

Retrieving callbacks

The following API methods allow you to access callbacks via the API:

 

{{codeStart}}

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

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

Accept: application/vnd.whispir.api-callback-v1+json

{

"status" : "1 to 3 of 3",

"callbacks" : [ {

"id" : "BCD374DABC73649B",

"name" : "Sample Callback 1",

"url" : "http://myserver.com/callback1.php",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/callbacks/BCD374DABC73649B?apikey=[API_KEY]",

"rel" : "self",

"method" : "GET"

} ]

},{

"id" : "AD34DBCEFD74EABC",

"name" : "Sample Callback 2",

"url" : "http://myserver.com/callback2.php",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/callbacks/AD34DBCEFD74EABC?apikey=[API_KEY]",

"rel" : "self",

"method" : "GET"

} ]

},{

"id" : "73BDCEFA43DF35DB",

"name" : "Sample Callback 3",

"url" : "http://myserver.com/callback3.php",

"link" : [ {

"uri" : "https://api.<region>.whispir.com/callbacks/73BDCEFA43DF35DB?apikey=[API_KEY]",

"rel" : "self",

"method" : "GET"

} ]

}, ],

"link" : [ ]

}

{{codeEnd}}