APIs that request information from Msgme use the HTTP GET method. Those that write data to Msgme use the POST method.
GET requests require a token, which can be obtained through an API key.
POST requests must be wrapped in an apiRequest element. One of the attributes of the request is the token. All the parameters in a POST method are wrapped by an element of the same element name.
<?xml version="1.0" encoding="UTF-8"?> <apiRequest token="[token]"> ... </apiRequest>
Every Msgme response will be in wrapped in an apiResponse element. There are 2 attributes in the apiResponse element: status and statusCode. The status attribute will contain a text string, while the status code will contain an HTTP code or Msgme specific status code.
Note: If an API requests contains errors or was unable to be completed, you will NOT receive an apiResponse element. Instead, you will get an apiError element, detailed in the next section.
<?xml version="1.0" encoding="UTF-8"?> <apiResponse status="[status text]" statusCode="[status code]"> ... </apiResponse>
Whenever there is an error with the API request Msgme will send back the error response wrapped in the apiError element. The apiError element contains three attributes: status, statusCode, and reason. The first two will contain the short text status code and numeric status code. The third attribute, reason, will contain a short description of why the API request failed. It's up to the actual API method to include any other elements in the apiError wrapper.
<?xml version="1.0" encoding="UTF-8"?> <apiError status="[status text]" statusCode="[status code]" reason=""> <response>...</response> </apiError>