Creates a new catalog rule
POST/catalogs/rules
If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags.
- If you have one catalog for all customers and channels, you can omit creating this resource.
- Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed.
- You cannot create catalog rules for organization catalogs.
For ideas about the kinds of business scenarios you can achieve with catalog rules, see Catalog Rules. To understand how catalogs are matched to shoppers by using rules, see Resolving Catalog Rules.
Request
- application/json
Body
required
Creates a catalog rule with the following attributes.
valid_from
matches the date and time that the catalog is displayed from.valid_to
matches the date and time the catalog is displayed to.- Array [
- ]
data objectrequired
attributes objectrequired
Possible values: non-empty
The name of a catalog rule. The name must not contain spaces.
A brief description of the purpose of a catalog rule.
The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.
The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.
The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the EP-Channel
header in your requests.
A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the EP-Context-Tag
header.
schedules object[]nullable
Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the EP-Context-Tag
header.
The schedules attribute must include the following.
Commerce runs on UTC time.
You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of "valid_from": "2022-06-01T05:00:00.000-05:00"
, "valid_to": "2022-06-15T11:59:99.000-08:00"
.
Matches the date and time that the catalog is displayed from.
Matches the date and time the catalog is displayed to.
The unique identifier of a catalog.
Possible values: [catalog_rule
]
This represents the type of object being returned. Always catalog_rule
.
Responses
- 201
- default
The created catalog rule
- application/json
- Schema
- Example (from schema)
Schema
valid_from
matches the date and time that the catalog is displayed from.valid_to
matches the date and time the catalog is displayed to.- Array [
- ]
data objectrequired
A catalog rule specifies which catalog to use for a given shopper context.
The catalog rule ID. Use this to get, modify, or delete the catalog rule.
attributes objectrequired
The name of a catalog rule. The name must not contain any spaces.
A brief description of the purpose of a catalog rule.
The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.
The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.
The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the EP-Channel
header in your requests.
A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the EP-Context-Tag
header.
schedules object[]
Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the EP-Context-Tag
header.
The schedules attribute must include the following.
Commerce runs on UTC time.
You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of "valid_from": "2022-06-01T05:00:00.000-05:00"
, "valid_to": "2022-06-15T11:59:99.000-08:00"
.
Matches the date and time that the catalog is displayed from.
Matches the date and time the catalog is displayed to.
The unique identifier of a catalog.
The date and time a catalog rule was created.
The date and time a catalog release is updated.
Possible values: [catalog_rule
]
This represents the type of object being returned. Always catalog_rule
.
links object
Links allow you to move between requests.
Single entities use a self
parameter with a link the specific resource.
Always the first page.
This is null
if there is only one page.
This is null
if there is only one page.
This is null
if there is only one page.
{
"data": {
"id": "8dbb35b2-ef04-477e-974d-e5f3abe6faae",
"attributes": {
"name": "rule-123",
"description": "Catalog Rule for most favored customers",
"account_ids": [
"string"
],
"customer_ids": [
"string"
],
"channels": [
"string"
],
"tags": [
"string"
],
"schedules": [
{
"valid_from": "2020-09-22T09:00:00",
"valid_to": "2020-09-22T09:00:00"
}
],
"catalog_id": "d09b4e16-08a5-4f42-817c-6e0d98acbb63",
"created_at": "2020-09-22T09:00:00",
"updated_at": "2020-09-22T09:00:00"
},
"type": "catalog_rule"
},
"links": {
"self": "string",
"first": "string",
"last": "string",
"prev": "string",
"next": "string"
}
}
Unexpected error.
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
errors object[]
{
"errors": [
{
"detail": "not processable",
"status": "422",
"title": "There was a problem processing your request."
}
]
}