Skip to main content

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.

note
  • 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

Body

required

Creates a catalog rule with the following attributes.

    data objectrequired
    attributes objectrequired
    name stringrequired

    Possible values: non-empty

    The name of a catalog rule. The name must not contain spaces.

    description stringnullable

    A brief description of the purpose of a catalog rule.

    account_ids string[]nullable

    The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.

    customer_ids string[]nullable

    The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.

    channels string[]nullable

    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.

    tags string[]nullable

    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.

    • 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.

    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".

  • Array [
  • valid_from date-timenullable

    Matches the date and time that the catalog is displayed from.

    valid_to date-timenullable

    Matches the date and time the catalog is displayed to.

  • ]
  • catalog_id stringrequired

    The unique identifier of a catalog.

    type stringrequired

    Possible values: [catalog_rule]

    This represents the type of object being returned. Always catalog_rule.

Responses

The created catalog rule

Schema
    data objectrequired

    A catalog rule specifies which catalog to use for a given shopper context.

    id stringrequired

    The catalog rule ID. Use this to get, modify, or delete the catalog rule.

    attributes objectrequired
    name stringrequired

    The name of a catalog rule. The name must not contain any spaces.

    description string

    A brief description of the purpose of a catalog rule.

    account_ids string[]

    The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.

    customer_ids string[]

    The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.

    channels string[]

    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.

    tags string[]

    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.

    • 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.

    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".

  • Array [
  • valid_from date-timenullable

    Matches the date and time that the catalog is displayed from.

    valid_to date-timenullable

    Matches the date and time the catalog is displayed to.

  • ]
  • catalog_id stringrequired

    The unique identifier of a catalog.

    created_at date-timerequired

    The date and time a catalog rule was created.

    updated_at date-timerequired

    The date and time a catalog release is updated.

    type stringrequired

    Possible values: [catalog_rule]

    This represents the type of object being returned. Always catalog_rule.

    links object

    Links allow you to move between requests.

    self urinullable

    Single entities use a self parameter with a link the specific resource.

    first urinullable

    Always the first page.

    last urinullable

    This is null if there is only one page.

    prev urinullable

    This is null if there is only one page.

    next urinullable

    This is null if there is only one page.

Loading...