A Message represents a change or an action performed on a resource, for example an Order or a Product.
firstName is present on a CustomerFirstNameSet Message).Message Types
To see a list of available Message Types for a specific resource, use the following table:
| Messages page | Represented resources |
|---|---|
| Approval Rule and Approval Flow Messages B2B | Approval Rules, Approval Flows |
| Business Unit and Associate Role Messages B2B | Business Units, Associate Roles |
| Cart and Order Messages | Carts, Orders, Recurring Orders, Order Edits |
| Customer Messages | Customers, Customer Tokens, Customer Groups |
| Payment Messages | Payments, Payment Methods |
| Pricing and Discount Messages | Cart Discounts, Discount Codes, Discount Groups, Standalone Prices |
| Product Catalog Messages | Products, Product Selections, Product Tailorings, Categories, Inventory Entries, Reviews |
| Quote Messages | Quote Requests, Staged Quotes, Quotes |
| Shopping List Messages | Shopping Lists |
| Store Messages | Stores |
Representations
Message
idString | Unique identifier of the Message. Can be used to track which Messages have been processed. |
versionInt | Version of a resource. In case of Messages, this is always 1. |
sequenceNumberInt | Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource. |
resource | Reference to the resource on which the change or action was performed. |
resourceVersionInt | Version of the resource on which the change or action was performed. |
typeString | Message Type of the Message. |
resourceUserProvidedIdentifiers | User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers. |
createdAt | Date and time (UTC) the Message was generated. |
createdByBETA | IDs and references that created the Message. |
lastModifiedAt | Value of createdAt. |
lastModifiedByBETA | IDs and references that last modified the Message. |
createdAt, lastModifiedAt, id, version, sequenceNumber, resource, resourceVersion, type.MessagePagedQueryResponse
limitInt | Number of results requested. Default: 20Minimum: 0Maximum: 500 |
countInt | Actual number of results returned. |
totalInt | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
When the results are filtered with a Query Predicate, total is subject to a limit. |
offsetInt | Number of elements skipped. Default: 0Maximum: 10000 |
resultsArray of Message | Messages matching the query. |
UserProvidedIdentifiers
resourceVersion.keyString | User-provided unique identifier of the resource. |
customerNumberString | User-provided unique identifier of a Customer. |
externalIdString | User-provided unique identifier of the resource. |
orderNumberString | User-provided unique identifier of an Order. |
skuString | Unique SKU of a Product Variant. |
slug | Unique identifier usually used in deep-link URLs for a Product. The value corresponds to the slug in the current Product Projection. |
containerAndKey | Unique identifier of a Custom Object. |
ContainerAndKey
ContainerAndKey is specific to Custom Objects. Custom Objects are grouped into containers, which can be used like namespaces. Within a given container, a user-defined key can be used to uniquely identify resources.keyString | User-defined identifier that is unique within the given container. |
containerString | Namespace to group Custom Objects. |
Enable querying Messages via the API
Get Message
view_orders:{projectKey}view_messages:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the Message. |
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/messages/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "2723ca8f-283c-4add-90bc-0978d195ed3c",
"version": 1,
"sequenceNumber": 4,
"resource": {
"typeId": "payment",
"id": "e57c8183-eb2b-4bf3-acf1-f8a7846689f8"
},
"resourceVersion": 5,
"resourceUserProvidedIdentifiers": {
"key": "e57-payment-key"
},
"type": "PaymentStatusInterfaceCodeSet",
"paymentId": "e57c8183-eb2b-4bf3-acf1-f8a7846689f8",
"interfaceCode": "InterfaceCodeString",
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"lastModifiedBy": {
"clientId": "ey8aTsYwE0_kxFvT1rJeglpC",
"isPlatformClient": false
},
"createdBy": {
"clientId": "ey8aTsYwE0_kxFvT1rJeglpC",
"isPlatformClient": false
}
}Query Messages
view_orders:{projectKey}view_messages:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20Minimum: 0Maximum: 500 |
offsetInt | Number of elements skipped. Default: 0Maximum: 10000 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/messages -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "2723ca8f-283c-4add-90bc-0978d195ed3c",
"version": 1,
"sequenceNumber": 4,
"resource": {
"typeId": "payment",
"id": "e57c8183-eb2b-4bf3-acf1-f8a7846689f8"
},
"resourceVersion": 5,
"resourceUserProvidedIdentifiers": {
"key": "e57-payment-key"
},
"type": "PaymentStatusInterfaceCodeSet",
"paymentId": "e57c8183-eb2b-4bf3-acf1-f8a7846689f8",
"interfaceCode": "InterfaceCodeString",
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"lastModifiedBy": {
"clientId": "ey8aTsYwE0_kxFvT1rJeglpC",
"isPlatformClient": false
},
"createdBy": {
"clientId": "ey8aTsYwE0_kxFvT1rJeglpC",
"isPlatformClient": false
}
}
]
}Check if Message exists
Check if Message exists by ID
id. Returns a 200 status if the Message exists, or a 404 status otherwise.view_messages:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the Message. |
curl --head https://api.{region}.commercetools.com/{projectKey}/messages/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"Check if Message exists by Query Predicate
200 status if any Messages match the query predicate, or a 404 status otherwise.view_messages:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
where |
curl --head https://api.{region}.commercetools.com/{projectKey}/messages -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"