|
|||||||||||||||||||||||||||||||||||||||||||||
|
|
ON THIS PAGE Show |
|
|
|
|
Most of our customers ingest their content using the Feed method. If you are not sure which method to use, we recommend starting with Feed. The Feed method allows you to:
|
|
|
|
Getting Content Updates Using Next Page Links (02:40)
Returns a feed of content matching the specified criteria. The returned feed items are sorted in chronological order, with the newest items at the bottom of the feed.
Feeds are used for content ingestion - monitoring a stream of content to receive all updates and new content going forward. To learn more, see Typical Feed Workflow and Feed Examples in Getting Started.
For efficiency on feed requests, the AP Media API server uses HTTP long polling where the server holds the client's feed request open until new content becomes available or up to 15 seconds. If there is new content when your client application makes the feed request, this content is immediately returned. Otherwise, the content is returned as soon as it becomes available during the next 15 seconds. An empty response is returned only if no new content is available after 15 seconds, which helps minimize the number of empty responses and improves efficiency.
|
|
To receive your AP breaking news content in a timely manner and to ensure your feeds do not get behind, follow the next_page link as soon as it is returned in the feed. There is no need to wait any period of time between your polling requests. |
|
|
|
Initial Feed Request URI (must be URL-encoded):
https://api.ap.org/media/v[{version}]/content/feed?[{optional_parameters}]
|
|
|
|
To check for any updates
since your previous feed request, you must
either follow the |
|
|
|
|
For more information, see API Versions.
For more information, see Supported Query Syntax.
pricing=true
in the request returns complete
pricing information for each content item, including formatted price,
use code and pricing message in addition to the price tags on renditions,
which are returned by default. To learn more, see Pricing.See Feed Examples in Getting Started and Supported Query Syntax.
The Feed method returns the standard HTTP status code of "200 - OK" and a feed of content in the JSON format.
Each feed entry includes the content item ID, a requested set of metadata and links to all renditions of the content item (for example, thumbnail, preview and high-resolution versions of a picture).
For information about error codes, see API Codes.
x-mediaapi-Q-name. The API method to which the throttle/quota applies (corresponds to the "method" property returned by Account Quotas. Possible values are search, feed, account, download, ondemand, item, other.
x-mediaapi-Q-secondsLeft. The number of seconds remaining in the current period.
x-mediaapi-Q-used. Indicates the current usage and limit (the maximum number or calls allowed during the period), in the format {usage}/{limit}; for example, 1/6.
x-mediaapi-QDay-minutesLeft. (Optional; returned if a per-day quota is configured) The number of minutes remaining in the current period.
x-mediaapi-QDay-used. (Optional; returned if a per-day quota is configured) Indicates the current usage and limit (the maximum number or calls allowed during the period), in the format {usage}/{limit}; for example, 2/5000000.
q
parameter
value used in the API request.next_page. A link to the next page of the feed.
|
|
|
|
To check for any updates
since your previous request, it is strongly recommended that your
client application use the |
|
|
|
|
items. Contains all of the items on this page.
|
|
|
|
The |
|
|
|
|
This example shows a response to the following request (the API key is supplied in the x-api-key request header):
https://api.ap.org/media/v/content/feed?q=productid:31989&include=*
The include=*
parameter is specified
in this request to illustrate the "products"
and "followedtopics"
properties, which are not returned by default.
{ "api_version": "2.0", "api_mode": "live", "api_build": "2.0.2", "id": "r10Q829oZ", "method": "/content/feed.GET", "org_name": "My Organization",
"params": { "include": [ "*" ], "q": "prodictid:31989", }, "data": { "query": "prodictid:31989", "updated": "2020-07-02T17:49:26.752Z", "page_size": 10, "current_item_count": 10, "next_page": "https://api.ap.org/media/v/content/feed?q=prodictid:31989&seq=217647413", "items": [ { "meta": { "products": [ { "id": 31989, "name": "AP Online Top General Headlines" } ], "followedtopics": [ // AP Newsroom Followed Topics to which the content item belongs ] }, "item": { // Human-readable usage terms, content metadata and download links } } ] } }