Fields
Needs Restrictions: Read and write, like the save it stands in for. It saves nothing: no restriction, no price and no change are written or announced. Send one of two bodies:
- A new restriction: the body you would send to POST /restrictions, checked as a create is. An only-show with no condition, or a
from_priceabove theto_price, is refused, as a save refuses it. - A change to a restriction:
restriction_idand the fields you would send to PATCH /restrictions/{id}, laid over it as the PATCH would lay them.
| Field | Type | Rule |
|---|---|---|
| restriction_idoptional | integer | A stored restriction to preview a change to. With it, every other field is optional and is laid over the restriction as a PATCH would lay it. Without it, the body is a new restriction's. |
| nameoptional | string | Up to 120 characters. Required for a new restriction. |
| restriction_typeoptional | string | exclude hides what it matches; only_show hides what no switched-on only-show matches. Required for a new restriction. |
| distributorsoptional | list of strings | Distributor slugs, as a product's sourced_from names them: it applies to those distributors' offers, never to your own stock. Empty or left out: any. |
| categoriesoptional | list of strings | Category slugs from GET /categories; each takes in the categories below it. Empty or left out: any. |
| manufacturersoptional | list of strings | Brand slugs from GET /manufacturers. Empty or left out: any. |
| product_classesoptional | list of strings | Product class slugs from GET /product-classes. Empty or left out: any. |
| upcsoptional | list of strings | UPCs, 6 to 14 digits each. A code that can never match (a spreadsheet's scientific notation, a leading apostrophe) is refused. Empty or left out: any. |
| skusoptional | list of strings | SKUs of up to 64 characters: a distributor's, matched against its offer, or your own in-house one. A code that can never match is refused. Empty or left out: any. |
| min_stockoptional | integer or null | 0 to 1000000. On an exclude, it matches an offer with fewer than this in stock; on an only-show, one with at least this many. Null: any. |
| from_priceoptional | string, number or null | The lowest distributor cost it matches, 0 to 9999999.99, at most two decimals, or null for no lower bound. |
| to_priceoptional | string, number or null | The highest distributor cost it matches, on the same terms, and never below from_price, or null for no upper bound. |
| disabledoptional | boolean | true keeps the restriction and hides nothing. |
| confirm_tokenoptional | string | Accepted, and changes nothing. |
| acknowledge_zero_matchoptional | boolean | Accepted, and changes nothing: a preview is never refused for matching nothing, it says so in zero_match. |
Each list takes at most 1,000 entries. Money with a third decimal is refused, never rounded. Name distributors in distributors: distributor_slug and distributor_slugs are refused.
The two confirmations a save asks for are not asked here: the preview is how you find out what they are about. 10 previews a minute per store, pricing rules and restrictions together, whichever key asks.
What it answers
The shape of a pricing rule preview, without this_rule: there applied_rule_id is the pricing rule that prices the product. A product it would hide has visible false and hidden_reason restricted after. For an only-show, what it hides is everything it does not name, so catalog_count against scope_count is the number to read, and the samples are drawn from the whole catalog as well.
Returns
- 200What saving it would do, in
data. Nothing was saved. - 404restriction_not_found: your store has no restriction with that
restriction_id. - 422validation_failed: a field broke a rule, as it would on the save.
- 429rate_limited: more than 10 previews in a minute for this store. Wait for
Retry-Afterseconds.
This endpoint can also answer 401 invalid_api_key, 403 license_not_active, 403 product_not_included, 403 insufficient_scope and 429 rate_limited.