Request Validation Segment
In the preceding example, the request was valid, as shown in the IsValid element.
<IsValid>True</IsValid>
The IsValid element pertains only to the validity of the request. It reports whether all of the required elements of a request are present, whether parameter restrictions and constraints have been obeyed, and whether parameter values are legal. IsValid does not assure that a valid request will be processed by Product Advertising API. For example, an ItemId, such as, 1234ABCD, is in the correct form, but no items in Amazon's catalog match that ItemId, so, the request would be valid but would return an error.
There are many reasons why a request can fail, as described in the following table.
Problem | Description |
---|---|
Incorrect parameters supplied |
The request is missing parameters that an operation requires, or the combination of parameters is not allowed, or the Service parameter was omitted. In this case, the IsValid value is "False" and the request is not processed by Product Advertising API. Common mistakes that cause these errors are spaces in the URL that prevent Product Advertising API from reading the entire request, or misspelled and mis-capitalized parameter names or values. If you inadvertently enter a space in a request, your browser automatically enters the URL-encoded form of a space: %20. For example, if you paste, ItemId= B12345, into your browser as part of a request, the URL field in the browser shows, ItemId=%20B12345. |
Invalid values |
The request might be syntactically correct but the values for one or more parameters might be invalid. For example, you might supply an ItemId value that does not match any item sold on Amazon. In this case, the IsValid value is "True" but an error message is returned that says that the value is "not a valid value for ItemId. Please change this value and retry your request." |
Empty result |
The request is valid but there is no data that matches the search criteria. In this case, the IsValid value is "True." Remember that parameter names and values are case sensitive. |
Network or processing error |
The request is valid but a network outage or processing failure has caused Product Advertising API to return an empty response. In this case, the IsValid value is "True." |
Partial request errors | Product Advertising API returns as much information as possible. For example, if you use a batch request and Product Advertising API finds items for one request but not the other, Product Advertising API returns all of the information for the found item and an error message for the other request. |
When one of these errors occurs, the IsValid value is False and Product Advertising API returns an error element in the Request Validation segment. The error element includes:
-
Error code—The title of the error
-
Error message—A brief description of the error condition
The following example shows an error message.
<Errors> <Error> <Code>missing_service_parameter</code> <message>Your request is missing the Service parameter. Please add the Service parameter to your request and retry. Valid values for the Service parameter include AWSEcommerceService.</message> </Error> </Errors>
The more difficult error to assess is a request that is valid, that is processed, but contains an error in logic. For example, a request might use default values such that only items in new condition are returned when the requester meant to return items in all conditions.
The remainder of the Request Validation segment is a subsection named after the
operation used in the request. In this example, the subsection is named
ItemLookup
Request. This subsection echoes the parameter
values used in the request. These values are returned for the purpose of
troubleshooting the request.