Staying Under Your Quota Limits

 

ON THIS PAGE      Show

 

 

 

 

About Quotas

AP Media API includes quotas, which limits the number of calls per minute that can be made to the service. If you exceed your quota limit, you will receive a 429 error code.

 

  Caution

 

If you exceed your quota, you may experience delays in content and/or delivery disruptions.

 

 

 

The following API methods are governed by quotas:

  • Search
  • Feed
  • Account
  • Rendition Download
  • On-Demand
  • Item Metadata

Viewing Quota Limits for Your Account

You can view quotas for your account by making the following API call (make sure to supply the API key in the x-api-key request header):

https://api.ap.org/media/v/account/quotas

To learn more, see Account Quotas.

Best Practices

Use these best practices to help you stay under your quota limits and ensure the efficiency of your integration:

  1. When using the Feed method, combine all product, package and personal Followed Topic feed IDs into a single URL call. This helps minimize the amount of duplicate content that you will receive and allows the API to run efficiently. To learn more, see Get Feed for Product IDs.

  2. Store the itemid and etag values for each piece of content (including all items in the "associations" section) in your database and compare each new item to the existing items in your database. If the itemid and etag are the same as for a previously downloaded item, retrieve it from your database instead of downloading the item again.

    Alternatively, if you are distinctly tracking all revisions of a content item (such as writethrus of a story), you can store the itemid along with the version value. To learn more, see Managing Revisions and Duplicates.

  3. If you have implemented the AP Media API to allow end users to make calls directly to the API service (for example, a search box in your editorial CMS that constructs and makes API calls "on the fly") and are receiving 429 error codes, you may want to consider returning a human-readable message to the end user requesting that they try their request again in a minute. To learn more, see 429 error code.

To see your quota balance and the remaining time until the next cycle:

Check the following values in the HTTP response headers:

  • x-mediaapi-Q-used
  • x-mediaapi-Q-secondsLeft

To learn more, see Response Headers.

 

  Tips

 

  • If you are only occasionally going over the quota limit, introducing a short delay prior to retrying should resolve the issue.

  • If you frequently exceed limits early in a cycle, you may want to audit your usage. Since quotas are tied to the specific API key, it is possible that another unintended instance of your application might be running elsewhere.