Results and Errors

As long as the request is valid, Product Advertising API will try to process it. There will be times when Product Advertising API returns a result and an error. For example, if you send a GetItems request with multiple ItemIds, where some of the ItemIds are invalid, response will be generated for all the valid ItemIds whereas response will be thrown for invalid ones. The same thing is valid for resources. If Product Advertising API is unable to serve any of the resource, it will try to serve the ones that it can. Product Advertising API attempts to return as much information as possible even when an error prevents the successful completion of a portion of a request.

Retrieving Errors

Typically, you want your application to check whether or not a request generated an error before spending any time processing the results. The easiest way to find out if an error occurred is to look for an Errors attribute in the JSON response. Each of the Error container contains Code and Message of the error.

Product Advertising API 5.0 tries to serve all the errors separately so that users do not have to look up the full responses if what they need is not served. For example, a GetItems request with multiple ItemsIds will contain Errors at the top level of the API response like this:

{
 "Errors": [
  {
   "__type": "com.amazon.paapi#ErrorData",
   "Code": "InvalidParameterValue",
   "Message": "The ItemId INVALID_ASIN3 provided in the request is invalid."
  },
  {
   "__type": "com.amazon.paapi#ErrorData",
   "Code": "InvalidParameterValue",
   "Message": "The ItemId INVALID_ASIN1 provided in the request is invalid."
  },
  {
   "__type": "com.amazon.paapi#ErrorData",
   "Code": "InvalidParameterValue",
   "Message": "The ItemId INVALID_ASIN2 provided in the request is invalid."
  }
 ]
}

results matching ""

    No results matching ""