Inaccurate Availabilities
The Availability parameter does a good job of filtering out of the response items that are unavailable. The parameter, however, is not foolproof. It is possible for an item to be unavailable for purchase even if:
-
The item is returned in a response
-
The response has been filtered using the Availability parameter
-
The Availability element in the response says the item can be shipped in twenty-four hours
For example, some items, including Variations parents and Collections parents, are never available for purchase because they do not represent real items; they are abstractions. These parent items, however, are often returned as being available. The following request returns a Collection parent item even though the Availability parameter is used.
http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService& AWSAccessKeyId=[AWS Access Key ID]
& Operation=ItemLookup
& ItemId=B0006PLAOE& Availability=Available& MerchantId=All& ResponseGroup=ItemAttributes,Offers& Condition=All
A snippet of the response shows that the Collection parent item is returned, so you might assume that it is available. However, the item is not associated with any offers, so it cannot be purchased.
<Item> <ASIN>B0006PLAOE</ASIN> ... <Offers> <TotalOffers>0</TotalOffers>
The contradiction of an item being available but not something you can buy shows that the Availability parameter is helpful but not the final arbiter in determining what items a customer can actually purchase. Instead, as was mentioned at the beginning of this chapter, a better test for availability is whether or not an item has an OfferListingId. Also, in the preceding example, you can see that you can test the value of TotalOffers to determine if an item has an offer.
Process to Include Item's Availability
1 | Include in an ItemSearch request Availability =
Available . |
2 | Include in the request ResponseGroup =
Offers . |
3 | Test to see that the value in the response for TotalOffers is greater than zero. |
Even though the Availability
parameter is not foolproof, it
does have value. The advantage gained by using the parameter is that it prevents the
return of items that certainly do not have an OfferListingId
.
This filtering reduces the amount of testing you need to do to make sure the
returned items have an OfferListingId
.