|
|||||||||||||||||||||||||||||||||||||||||
Managing Revisions and Duplicates
Video TutorialManaging Revisions and Duplicates (02:01) What are revisions?As news stories evolve, and AP's editorial teams gather additional information and multimedia, updates to a content item are published to the AP Media API throughout the day. These updates are referred to as content item revisions. Some examples are:
What are duplicates?Duplicate content may be delivered for a variety of reasons; for example:
Which metadata tags can I use to manage revisions and detect duplicates?To enable tracking and management of content item revisions and duplicate
detection, the AP Media API returns the following metadata values for
each content item in the Search, Feed and Item Metadata responses: Item ID (
Item IDA unique ID that remains the same throughout all revisions of the content item; for example, all stories that have the same item ID are part of the same 'story chain'. ETagThe ETag value is a unique token for each revision of a content item, which changes not only when there are updates to the story body or item metadata, but also to any item component; for example, if new linked curated media or media renditions are added to the content item. The include/exclude parameters have no impact on the ETag values. VersionThe content item version number: typically 0 for the initial version, 1 for the first version, 2 for the second version and so on. The higher the number, the more recent the content item's version.
How can I determine if a content item is a new revision of one previously downloaded?If the Item ID value matches one that you previously ingested, but the ETag value for that item differs from the ETag of the previously downloaded item, download and overwrite the previous revision. For more information, see Using ETags and Client Caching to Manage Revisions and Duplicates. How can I determine if a content item is a duplicate of one previously downloaded?If the Item ID value matches one that you previously downloaded, and the ETag value for that item matches the ETag of the previously downloaded item, the item is a duplicate, and you do not need to download it again. For more information, see Using ETags and Client Caching to Manage Revisions and Duplicates. Using ETags and client caching to manage revisions and duplicatesIt is recommended that your client application cache a response received from the AP Media API server and then use ETags returned by the API to ensure that you download the same content item more than once only if it has become outdated. Since the ETag value serves as a unique token for each revision of a content item, it can be used by caching applications to determine if their cache is up-to-date.
Detecting duplicates using a cache key with ETag validationWhen caching content items returned in the Search,
Feed or Item Metadata responses or linked items referenced in To determine whether the cached document is the latest,
use the ETag
value (
Detecting duplicates using conditional Item Metadata requests
In addition to returning the ETag value in
Your client application can cache the ETag value and then send it in the standard HTTP "If-None-Match" header as a conditional request to the AP Media API server to ensure that the cached document is the latest version. If the client's document is the latest (based on the
ETag value), the server sends back the Alternatively, if the client's document is outdated,
the server sends back the |