post https://restapi.ordergroove.com/products//selection_rules/ordinal/manage/
This API allows you to take an existing standard product and configure it into a valid ordinal rotating product or to manage an existing configuration.
Authentication
Ordinal Selection Rule Validations
There are 3 base validation rules for defining Ordinal Selection Rules:
- You must define at least one selection rule with a
starting_ordinal
of 0. This represents the delivery product associated with the checkout order. starting_ordinal
s must be in the set of natural numbers, meaning they must be non-negative integers.- The
starting_ordinal
must be unique amongst all of the Selection Rules associated with the Rotating Product Subscription.
When using
cyclical_starting_ordinal
, its value must be between 0 and the largeststarting_ordinal
from the selection rules defined in the list. This parameter is optional and only relevant ifcyclical_rotation_enabled
is set totrue
.
If validation fails no changes will be made to the product and no Selection Rules will be created, updated or deleted.
How to setup Ordinal Based Rotation using this API
- Choose an existing Standard or Rotating Product, if you don’t have one yet you will need to create one before you proceed with this configuration.
- Decide which selection rules you want to add, update or delete:
- All the rule validation explained above apply here, meaning that if you don’t follow them your update won't happen;
- Your changes will be reflected in all order items that haven’t had their Order Reminder sent or gone through the Send Now flow;
- You can add a new selection rule;
- You can delete an existing selection rule;
- You can update an existing selection rule with a different product and or starting date;
- (Optional) If you're enabling cyclical rotation, you may also configure
cyclical_starting_ordinal
. This defines whichstarting_ordinal
the rotation should restart from. It must be defined between 0 and the largest selection rule’sstarting_ordinal
. - Hit the API with the configuration, and the Ordinal Rotating Product setup is complete.
Response Body Definitions
Name | Type | Description | Example |
---|---|---|---|
array of objects | Array of objects that reflect the current rotation configurations | see below |
[
{
"public_id":"e1a61e620ed411ef8740767250df1ed7",
"selection_rule_type":"ORDINAL",
"product_selection_list_elements":[
{
"public_id":"e1a626000ed411ef8740767250df1ed7",
"product":"48398751432995",
"starting_ordinal":"0"
},
{
"public_id":"e1a62b140ed411ef8740767250df1ed7",
"product":"48398752317731",
"starting_ordinal":"1"
},
{
"public_id":"e1a62fe20ed411ef8740767250df1ed7",
"product":"48398760149283",
"starting_ordinal":"4"
}
],
"configuration": {
"reveal_moment": "ORDER_PLACEMENT",
"cyclical_rotation_enabled": true,
"cyclical_starting_ordinal": 1,
"pricing_policy": "BEST_PRICE"
}
}
]
To get the all the rules from the rotating product use get product or list product endpoints with
?include_product_selection_rules=true
as a query param