Error handling for API

When you make any API call that results in an error (SOAP fault) message, specific information about the nature of error is provided. Various error cases are handled and related error information is returned for most of the APIs that we consider helpful. To extract the error information, the SOAP fault message must be parsed. APIs return error information in three parts within SOAP fault message as explained below:

  • faultString (string)– generic message with standard or specific message
  • detail.code (integer) – numeric code
  • detail.description (string) – short description about the error

The following is the sample SOAP fault message:

<soap:Fault>
 
<faultcode>soap:Server</faultcode>
<faultstring>An error occurred in processing your request, please try again
</faultstring>
 
<detail>
<code>201</code>
<description>Unable to find shopper from the specified email address
</description>
</detail>
 
</soap:Fault>