Skip to main content

Updates a catalog rule

PUT 

https://euwest.api.elasticpath.com/catalogs/rules/:catalog_rule_id

Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated.

Request

Path Parameters

    catalog_rule_id stringrequired

    The catalog rule ID.

Bodyrequired

An updated catalog rule with the following attributes.

    data objectrequired
    idstringrequired

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

    Example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae
    attributes object
    namestringnullable

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

    Possible values: non-empty

    Example: rule-123
    descriptionstringnullable

    A description of the purpose of a catalog rule.

    Default value:
    Example: Catalog Rule for most favored customers
    account_idsstring[]nullable

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

    customer_idsstring[]nullable

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

    channelsstring[]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.

    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_fromstring<date-time>nullable

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

    Example: 2020-09-22T09:00:00
    valid_tostring<date-time>nullable

    Matches the date and time the catalog is displayed to.

    Example: 2020-09-22T09:00:00
  • ]
  • tagsstring[]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.

    catalog_idstringnullable

    The unique identifier of a catalog rule.

    Example: d09b4e16-08a5-4f42-817c-6e0d98acbb63
    pricebook_idstringnullable

    The unique identifier of a price book to associate with a rule. You can specify a pricebook_id or a pricebook_ids but not both. If you specify both, a 422 unprocessable entity error is displayed.

    pricebook_ids object[]

    If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books.

    Possible values: <= 5

  • Array [
  • idstring<uuid>required

    A unique identifier of a price book.

    priorityintegerrequired

    Priority is a number and the price book with the highest number has the highest priority.

  • ]
  • typestringrequired

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

    Possible values: [catalog_rule]

    Example: catalog_rule

Responses

An Updated catalog rule with the following attributes.

Schema
    data objectrequired

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

    idstringrequired

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

    Example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae
    attributes objectrequired
    namestringrequired

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

    Example: rule-123
    descriptionstring

    A brief description of the purpose of a catalog rule.

    Default value:
    Example: Catalog Rule for most favored customers
    account_idsstring[]

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

    customer_idsstring[]

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

    channelsstring[]

    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.

    tagsstring[]

    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_fromstring<date-time>nullable

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

    Example: 2020-09-22T09:00:00
    valid_tostring<date-time>nullable

    Matches the date and time the catalog is displayed to.

    Example: 2020-09-22T09:00:00
  • ]
  • catalog_idstringrequired

    The unique identifier of a catalog.

    Example: d09b4e16-08a5-4f42-817c-6e0d98acbb63
    created_atstring<date-time>required

    The date and time a catalog rule was created.

    Example: 2020-09-22T09:00:00
    updated_atstring<date-time>required

    The date and time a catalog release is updated.

    Example: 2020-09-22T09:00:00
    pricebook_idstringnullable

    The unique identifier of a price book to associate with a rule. You can specify a pricebook_id or a pricebook_ids but not both. If you specify both, a 422 unprocessable entity error is displayed.

    pricebook_ids object[]

    If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books.

    Possible values: <= 5

  • Array [
  • idstring<uuid>required

    A unique identifier of a price book.

    priorityintegerrequired

    Priority is a number and the price book with the highest number has the highest priority.

  • ]
  • typestringrequired

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

    Possible values: [catalog_rule]

    Example: catalog_rule
    links object

    Links allow you to move between requests.

    selfstring<uri>nullable

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

    firststring<uri>nullable

    Always the first page.

    laststring<uri>nullable

    This is null if there is only one page.

    prevstring<uri>nullable

    This is null if there is only one page.

    nextstring<uri>nullable

    This is null if there is only one page.

Authorization: Authorization

name: Authorizationtype: httpin: headerscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://euwest.api.elasticpath.com/catalogs/rules/:catalog_rule_id");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <Authorization>");
var content = new StringContent("{\n \"data\": {\n \"id\": \"8dbb35b2-ef04-477e-974d-e5f3abe6faae\",\n \"attributes\": {\n \"name\": \"rule-123\",\n \"description\": \"Catalog Rule for most favored customers\",\n \"account_ids\": [\n \"string\"\n ],\n \"customer_ids\": [\n \"string\"\n ],\n \"channels\": [\n \"string\"\n ],\n \"schedules\": [\n {\n \"valid_from\": \"2020-09-22T09:00:00\",\n \"valid_to\": \"2020-09-22T09:00:00\"\n }\n ],\n \"tags\": [\n \"string\"\n ],\n \"catalog_id\": \"d09b4e16-08a5-4f42-817c-6e0d98acbb63\",\n \"pricebook_id\": \"string\",\n \"pricebook_ids\": [\n {\n \"id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"priority\": 0\n }\n ]\n },\n \"type\": \"catalog_rule\"\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com
Auth
Parameters
— pathrequired
Body required
{
  "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"
      ],
      "schedules": [
        {
          "valid_from": "2020-09-22T09:00:00",
          "valid_to": "2020-09-22T09:00:00"
        }
      ],
      "tags": [
        "string"
      ],
      "catalog_id": "d09b4e16-08a5-4f42-817c-6e0d98acbb63",
      "pricebook_id": "string",
      "pricebook_ids": [
        {
          "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "priority": 0
        }
      ]
    },
    "type": "catalog_rule"
  }
}
ResponseClear

Click the Send API Request button above and see the response here!