Consuming Catalog Projections
You can consume category projections from Syndication API in the following ways:
- Using the information in a JMS event message
- Using the
modifiedSince
andmodifiedSinceOffset
parameters
JMS Event Messages
Content Management Systems (CMS) can use ActiveMQ to fetch updates to catalog projections using JMS messages sent from Elastic Path Commerce Manager.
In ActiveMQ, you can consume catalog projections with the event message in the VirtualTopic.ep.catalog
topic. For more information about event messaging, see Catalog Syndication Event Messages.
The event message contains the following information to retrieve the catalog projections:
- Store
- Projection Type
- Code
With this information, you can use the syndication API directly and go to:
/catalog/{store_code}/{projectionType}/{code}
You can also POST
a JMS message back to one of the following URLs:
/api/syndication/v1/catalog/ca/{projectionType}events
/api/syndication/v1/catalog/ca/optionevents
/api/syndication/v1/catalog/ca/brandevents
/api/syndication/v1/catalog/ca/offerevents
/api/syndication/v1/catalog/ca/categoryevents
/api/syndication/v1/catalog/ca/attributeevents
/api/syndication/v1/catalog/ca/fieldmetadataevents
REST API Parameters
You can consume catalog projections directly from syndication API instead of using JMS messaging.
You can use syndication API URL to fetch category projections. For example, you want to periodically check an offer for an Android phone. You can use the following URL with the code to fetch this specific projection:
/catalog/{store_code}/offers/{attributeCode}
If you do not know the catalog projection code, you can still fetch a catalog projection directly from the syndication API. Use the syndication API URL /catalog/{storeCode}/<entity>
to retrieve all projections for the entity, such as, offers. For more information about the syndication API URIs, see the syndication URI section.
You can also receive specific projections using the following parameters:
limit
startAfter
modifiedSince
modifiedSinceOffset
For more information about these parameters, see the Catalog Syndication API parameter section.
ETag Response Header
Each API response includes an ETag response header for caching. You can use the ETag hash value in a GET
request to receive the status of a specific entity from your developer environment.
When you retrieve specific catalog projections, syndication API includes an ETag response header for caching. ETag values are only present in the /catalog/{storeCode}/{entity}/{entityCode}
URL, such as, /{offerCode}
when the code is known. There is no ETag value for syndication API URLs without specific product codes.
The following example header contains a hashed value of the response body:
GET /api/syndication/v1/catalog/<store>/options/<BLUE>ca/007FAB1CD7BE2AA97C262F82603A83BF096C33C5863F33A2486FFD3258E8FAFC HTTP/1.1 If-None-Match:"<etag value>"
Cortex returns the following status messages:
200 OK - success
The web projection has updates. Use the new ETag hash value to get content updates. The old hash value is no longer valid.
304 Not modified - requested object not changed
The web projection has no updates. Continue to use this value to check for updates.
404 Not found - requested object not found
The web projection does not exist