Important note for users of JSON search results: If you are currently requesting search results in JSON, you must make changes to your client application to process the error messages returned in JSON.
By default, error messages are returned in XML. If JSON is requested (in the Accept header or in the format parameter value), the error is now returned in JSON. For example, the following error is returned if JSON is requested and detail=tires is specified instead of detail=tiers in the My Plans request:
{
"code": 400,
"detailCode": 5001,
"message": "Specified value for detail 'tires' is invalid"
}
In addition to HTTP status codes, Content API now returns detail error codes if available. For example, the following error is returned if query is specified instead of q in the search request:
<Error xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Code>400</code>
<DetailCode>5000</DetailCode>
<Message>Specified parameter 'query' is invalid</Message>
</Error>
To access the list of detail error codes in XML:
http://api.ap.org/v2/docs/errors?apikey={apiKey}
To access the list of detail error codes in JSON:
http://api.ap.org/v2/docs/errors?apikey={apiKey}&format=json
For more information about API codes and suggested actions, see “API Codes”.
A use code is now returned in addition to the pricing message in search results and full item metadata responses if the showPricing=true parameter is specified in the request:
Pricing Scenario | Use Code | Plan Type | API Pricing Message |
---|---|---|---|
Included in Your Plan | 810 | Choice | Included in your Choice plan at the Tier indicated |
Included in Your Plan | 801 | Other plans | Included in your plan |
Not Included in Your Plan (Extra Charge) | 851 | All plans | Not included in your plan. Available for an extra charge. |
Not Included in Your Plan (Contact Licensing) | 860 | All plans | Not included in your plan. To learn more about license rights, please contact your licensing representative. |
In XML search results and full item metadata responses, the use code for the pricing message is returned in the “role” attribute of the usageTerms
element (for example, role="apusecode:801"
):
<usageTerms role="apusecode:801">Included in your plan.</usageTerms>
####JSON
In JSON search results, the pricing message use code is returned in the “apUseCode” property; for example:
"usageTerms": [
"This content is intended for editorial use only. For other uses, additional clearances may be required.",
"No Use in Japan",
"Included in your plan."],
"apUseCode": "801",