Skip to content
Esc
↑↓navigate↵open⌘Jpreview

Upsert product list rules

Bulk-creates and updates product list rules grouped per smart product list. Rules are only allowed on smart lists; a rule without id is created, a rule with id is updated.

PUT/api/v2/{team_slug}/{app_slug}/product-lists/rules
Authorization
AuthorizationBearer token · headerrequired

Management API token, sent as Authorization: Bearer <token>.

Path parameters
team_slugstringrequired
app_slugstringrequired
Request body
requiredapplication/json
product_listsUpsertProductListRulesGroup[]required
min items 1 · max items 20
Show properties
Array of UpsertProductListRulesGroup
product_list_idUUIDrequired
rulesUpsertProductListRuleItem[]required
min items 1 · max items 20
Show properties
Array of UpsertProductListRuleItem
idUUID | null

Omitted on create, required to update an existing rule

Show properties
Any of:
UUID
string<uuid>
null
null
targetstringrequired
Allowed:stockpricesale_priceis_on_saleattributecategorycollectiontagbrandserie
operatorstringrequired
Allowed:less-thangreater-thanequalnot-equal
target_idsUUID[]
target_stockinteger
target_price_centsinteger

Gross cents (amount_cents_with_tax or sale_price_with_tax) for the selected store group and market.

target_is_on_saleboolean
store_group_idUUID | null

Required with market_id for price and sale_price targets.

Show properties
Any of:
UUID
UUID
null
null
market_idUUID | null

Required with store_group_id for price and sale_price targets.

Show properties
Any of:
UUID
UUID
null
null
Responses
200

OK (partial success possible)

dataProductListRule[]required
Show properties
Array of ProductListRule
idUUIDrequired
product_list_idUUIDrequired
targetProductListRuleTargetrequired
Allowed:stockpricesale_priceis_on_saleattributecategorycollectiontagbrandserie
operatorProductListRuleOperatorrequired
Allowed:less-thangreater-thanequalnot-equal
target_idsUUID[]
target_stockinteger | null
target_price_centsinteger | null

Gross cents (amount_cents_with_tax or sale_price_with_tax) for the selected store group and market.

target_is_on_saleboolean | null
store_group_idUUID | null

Price scope for price and sale_price targets.

Show properties
Any of:
UUID
string<uuid>
null
null
market_idUUID | null

Price scope for price and sale_price targets.

Show properties
Any of:
UUID
string<uuid>
null
null
created_atstring<date-time>required
updated_atstring<date-time> | null
errorsProductListRuleError[]required
Show properties
Array of ProductListRuleError
product_list_idUUIDrequired
idUUID | null
Show properties
Any of:
UUID
string<uuid>
null
null
messagestringrequired
400

Request-level failure

errorErrorBodyrequired
Show properties
messagestringrequired
detailsstring[]required
401

Request-level failure

errorErrorBodyrequired
Show properties
messagestringrequired
detailsstring[]required
403

Request-level failure

errorErrorBodyrequired
Show properties
messagestringrequired
detailsstring[]required
500

Request-level failure

errorErrorBodyrequired
Show properties
messagestringrequired
detailsstring[]required
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT 'https://api.enad.io/api/v2/string/string/product-lists/rules' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "product_lists": [
    {
      "product_list_id": "0f6ee94d-19db-428e-bfbb-16abab301909",
      "rules": [
        {
          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
          "target": "stock",
          "operator": "less-than",
          "target_ids": [
            "497f6eca-6276-4993-bfeb-53cbbbba6f08"
          ],
          "target_stock": 0,
          "target_price_cents": 0,
          "target_is_on_sale": true,
          "store_group_id": "6c760e36-a704-4b09-93bb-c191a46ca67f",
          "market_id": "6364d859-8e1b-477a-bacc-de8305a9292b"
        }
      ]
    }
  ]
}'
Response
{
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "product_list_id": "0f6ee94d-19db-428e-bfbb-16abab301909",
      "target": "stock",
      "operator": "less-than",
      "target_ids": [
        "497f6eca-6276-4993-bfeb-53cbbbba6f08"
      ],
      "target_stock": 0,
      "target_price_cents": 0,
      "target_is_on_sale": true,
      "store_group_id": "6c760e36-a704-4b09-93bb-c191a46ca67f",
      "market_id": "6364d859-8e1b-477a-bacc-de8305a9292b",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "errors": [
    {
      "product_list_id": "0f6ee94d-19db-428e-bfbb-16abab301909",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "message": "string"
    }
  ]
}