Discount search
In some scenarios you might want to find discounts (i.e. discount offers, multibuy or mix and match) that can apply to a certain combination of items (e.g. to show related discounts for items). The search finds the intersection of discounts for all the items that are searched for.
To illustrate this we will use an example with three items that belong to different discounts:
Item | Discounts |
---|---|
Item A |
|
Item B |
|
Item C |
|
This search endpoint will find the intersection of those discounts.
Example 1:
Searching for items:Item A, Item B and Item C the endpoint would return the discounts that intersect all three items which in this case would be "Multibuy ABC":
Example 2:
Searching for items: Item A and Item B the endpoint would return the intersection of those two items which in this case would be "Multibuy ABC" and "Discount offer AB":
Actions
POST |
Search for discount offers that match a given combination of items |
Properties
DiscountSearchFilter
Field | Data type | Validation | Description |
---|---|---|---|
itemIDs | list |
- |
The list of one or more item identifier ids that should be used to find a discount for |
DiscountSearchResult
Field | Data type | Validation | Description |
---|---|---|---|
id | string |
- |
Discount unique number |
offerType | int |
Type of the discount offer:
|
|
priority | int |
Offer priority ![]() The priority of the offer controls which offer is triggered if the item exists in more than one offer of the same category. A lower priority number gives the offer a higher priority. |
Examples
Search for discount offers that match a given combination of items
Finds the intersection of discount offers that contain all the given items. This can be used to find which discount offers can be active given a specific combination of items.
POST /api/discount/get-for-items
Permissions
-
DiscountOffer:Read
For more information on authenticating to LS One APIs, see Authentication.
Request
curl -X 'POST' \
'https://lsoneapi.lsretail.com/api/discount/get-for-items' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer {authorization_token}' \
-H 'Content-Type: application/json' \
-d '{
"itemIDs": [
"40120"
]
}'
Parameter | Data type | Validation | Description |
---|---|---|---|
itemIDs | list | - | The list of one or more item identifier ids that should be used to find a discount for |
Response
[
{
"id": "D000001",
"offerType": 2,
"priority": 160
}
]
Status codes
Code | Text | Description |
---|---|---|
200 | Success | Success |
401 | Unauthorized | LS One API client did not provide a valid authentication token or it does not have permissions to read retail item(s) |