Event stores
The event store object and how to fetch event stores
Event stores are associated with all the other resources and generated upon every creation, update, or cancellation of the related resource to help you track the history of each resource's data changes by providing paginated event access via API.
Each event store object contains information about the event that generated it (one of create
or update
), the type of resource that was created or updated, the request involved, the application, worker, or user that triggered the change, and more. You can find the change history inside the payload
object, which shows, for each modified attribute, the values before and after the change.
Fetching the event stores of a resource
To fetch all the events involving a specific resource, send a GET
request to the /api/{{resource_name}}/:id/event_stores
endpoint, where {{resource_name}}
is the name of the resource (e.g. skus
, customers
, orders
, etc.). You need to use integration API credentials.
Example
The following request fetches the event stores associated with the SKU identified by the ID xYZkjABcde
:
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/event_stores' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token'
The returned event stores list is neither filterable nor sortable by any attribute.
Pagination
When you fetch the event stores of a resource, you get paginated results.
The pagination method used for the event store resource is slightly different from the one used for all the other resources, being based on a cursor instead of the page number.
No record or page count is available in the meta
attribute. Unless you're requesting the last page, you can find the URL of the next page in the links
attribute:
{
"data": [...],
"meta": {},
"links": {
"next": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/event_stores?page[after]=1a123456-a95b-4212-88c9-3478697a2ad8&page[size]=10"
}
}
If you need to modify the default page size, use the page[size]
query parameter in your request. To navigate through the paginated results, use the page[after]
query parameters in your request:
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/event_stores?page[after]=1a123456-a95b-4212-88c9-3478697a2ad8&page[size]=5' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token'
Last updated