Error Messages

In addition to the HTTP response code, failed calls will contain error information in the message body. The format depends on where the error was generated. Messages generated by the Mashery Gateway have a different schema to messages generated by the API itself.

Example Mashery Gateway Error Message

Code snippet: Json
{ “Error”: “Not Authorized” }

Mashery errors are typically related to access control rather than URL content. It's likely that your access token is not valid for the requested resource. The request was not processed by the API.

Example API Error Message

Code snippet: XML
<?xml version="1.0" encoding="UTF-8"?>
  <ProcessingError RetryIndicator="false">
    <Description>Invalid country code. Example: /references/countries/CH</Description>
    <InfoURL>not supported yet:{processingError.Code}</InfoURL>

The API is still a prototype and not all aspects of the error handling schema are supported. There should, however, be enough information in the response to see the reason for the error and whether it is worth sending the same request again.

API Error Message Structure

Key Description
ProcessingError@RetryIndicator "True" indicates that the response can be retried (e.g. if a request to an over-loaded server times-out)."False" indicates that retrying the same request will certainly fail; the request should be modified.
ProcessingError.Type The category of error:
  • Authentication
    • Expired Credentials
    • Wrong/invalid Credentials
  • InputValidation
    • Input is not what is expected
    • Error in input format
    • Not all parameters given
  • ResourceNotFound
    • the URL references a resources that the API does not have
ProcessingError.Code Error code relating to a particular type of error. The codes are in ranges according to error type. In future versions of the API it will be possible to use this code to uniquely identify a particular error.
  • Authentication: 1000 – 1999
  • InputValidation: 2000 – 2999
  • ResourceNotFound: 3000 – 3999
ProcessingError.Description A text description of the error - generally sufficient for a human user to understand what has gone wrong.
ProcessingError.InfoURL A future enhancement will be to provide a link to an online description of the error. It is not currenlty supported.