Price List endpoints
Verb | Path | Method |
---|---|---|
POST | /api/v1/price_list/bulk_create/ | Create Price Lists |
POST | /api/v1/prices/bulk_add_products/ | Add products to a Price List |
POST | /api/v1/prices/bulk_update_prices/ | Update prices in a Price List |
POST | /api/v1/prices/get_prices/ | Read prices in a Price List |
POST | /api/v1/prices/sync_with_catalog/ | Sync a Price List with the catalog, based on its product_filters |
Price Lists can be created via this API, in bulk.
name
description
valid_from
valid_to
price_dimensions
margin_formula
product_filters
is_calendar
type: string, Required
The name of the price list
type: string, default: unknown, Optional
The description of the price list
type: date yyyy-mm-dd, Required
Start date of price list's validity period
type: date yyyy-mm-dd, Required
End date of price list's validity period
type: [strings], default: ["price"], Optional
List of price column names
type: string, default: see below, Optional
Formula to compute the margin in the price list
Its default value depends on cost columns:
"= (Price - {Sum of Costs}}) / Price * 100"
e.g. if we have 2 cost columns with letters J and G:
"= (Price - (J + G)) / Price * 100"
type: dict, default: {}, Optional
Filter on catalog products
e.g. if we only want to allow certain categories and cities :
{"category": ["Kids", "Teens"], "city": ["Paris", "Berlin"]}
The default value {} means we allow all products
type: bool, default: False, Optional
Flag to know if price list should be calendar. If True; price list will have a horizon of 365 days
Upon success, the response is 201 OK and returns
Once a price list has been added, or already exists, we can add products to it. Their price will be set to 0. Notes:
- the products will be first added to the price list draft, then the price list will be published
- this endpoint only works with price lists that were created through the above API. It does not support the price lists created through the UI
price_list_name
code
{extensions if any}
type: string, Required
The name of the price list
type: string, Required
Product code
type: Any, Required
Product extensions
For instance if have defined 2 extensions in our catalog, agencies (string) and size (integer), we have to mention them in our payload. See example below
Upon success, the response is 201 OK and returns either the ids of the rows added to the Price List, or job infos. Indeed, if you add a lot of products (> 100), we launch an async job and the products will be added in the background:
Once products have been added to a Price List, or already were, we can update their prices. Notes:
- the prices will be directly updated / set in the published version. Here, we do not alter the draft
- this endpoint only works with price lists that were created through the above API. It does not support the price lists created through the UI
price_list_name
code
{extensions if any}
price
price_dimension
date
type: string, Required
The name of the price list
type: string, Required
Product code
type: Any, Required
Product extensions (see above endpoint)
type: float, Required
Price to set
type: string, Required | Optional
Price dimension for which we set the new price
Required if Price List is multidimensional (e.g. ["p1, "p2"] )
type: yyyy-mm-dd date, Required | Optional
Date for which we set the new price
Required if Price List is calendar
Upon success, the response is 201 OK and returns the ids of the updated rows :
This endpoint lets you read prices in a Price List. Notes:
- this endpoint works only with price lists that are published
price_list_name
promotion_date
code
{attributes if any}
{extensions if any}
price_dimension
date
promotion
type: string, Required
The name of the price list
type: yyyy-mm-dd date, Optional, default: today
Date on which we'll be looking for active promotions
type: string, Optional
Product code
Absent code will be treated as a wildcard
type: Any, Optional
Product attributes.
Only used if code is not mentionned
type: Any, Optional
Product extensions.
Here, absent extensions will be treated as wildcards
type: string, Required | Optional
Price dimension for which we want to read the price
Required if Price List is multidimensional (e.g. ["p1, "p2"] )
type: yyyy-mm-dd date, Required | Optional
Date for which which we want to read the price
Required if Price List is calendar
type: string, Optional
Specific promotion to look for
If no promotion is mentionned, all promotions that are valid on promotion_date will be computed
Upon success, the response is 201 OK and returns the payload rows, enriched with the active price and other potentially useful metadata :
Let's say we don't mention agencies in the payload below:
We then get the prices for the code, size, price_dimension and date specified in the payload, exploded to every agencies in the data ("00_01", "00_02", ...) :
Remark:
- you can remove as many extensions as you like from the payload
- you can even remove the product code
- you can also use attributes without the product code
Once a price list has been added, or already exists, you can synchronise its content with the current catalog products, based on product_filters.
For instance, if you created the Price List with product_filters = {"category": ["Kids", "Teens"], "city": ["Paris", "Berlin"]} , and you execute the following three updates on the catalog, then this is what would happen if you call our sync endpoint:
catalog update | pk | code | category | city | already in Price List ? | filtered in ? | consequence: |
---|---|---|---|---|---|---|---|
Nothing | 1 | AZERTY | Kids | Paris | Yes | Yes | Nothing: keep in Price List |
Changed "category" from "Kids" to "Adults" | 2 | UIOP | Adults | Paris | Yes | No | Remove from Price List |
Added the row | 3 | QSDFG | Teens | Berlin | No | Yes | Add to Price List |
Added the row | 4 | HJKL | Teens | Rome | No | No | Nothing: keep out of Price List |
The price of newly added products will be set to 0. Notes:
- the products will be first added / removed to the price list draft, then the price list will be published
- this endpoint currently only works with price lists that were created through the above API. It does not support the price lists created through the UI
price_list_name
type: string, Required
The name of the price list
Upon success, the response is 201 OK and returns either the ids of the added/removed/untouched rows, or job infos. Indeed, if you add a lot of products (> 100), we launch an async job and the products will be added in the background: