Product Price
This article provides comprehensive information and documentation on a set of API methods specifically designed to handle product prices. By leveraging these methods, users can retrieve, search, and create product prices, allowing for seamless integration and management of product price data within the system.
The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product price API.
Get Product Price
Product Price is used to assign a price to a product. Product price objects relate to a price list. Thus, a catalog item can have a price via relation between the catalog, price list and product price.
Parameter
Data Type
In
Description
api_token
string
header
limit
integer
query
Amount of items per page that will be returned
page
string
query
Page number to return
Note: If limit and page parameters are not sent, response returns 10 product prices by default.
Request GET
GET request is used for reading current product prices from Omnitron (both i1 and v1 can be used). This request is expected to return all product prices data according to page and limit parameters.
‘content_type’ header represents the response type.
‘Authorization’ header is a required header for authentication. You can retrieve api_token with login.
Path: product_price/
Response
Returns product prices as paginated. Successful response status is expected to be HTTP-200 OK. If ‘i1’ is used in the request, the response may not contain some of the below fields (properties).
Resource properties are in Python format.
Property
Data Type
Description
product
Related product id (product_sku for i1)
Related product ID (product_sku for i1)
price
float
Product price
currency_type
string enum
Currency of the price field, default currency is ‘try’
tax_rate
float
Ad valorem tax rate (Ex: 18.00)
retail_price
float
Retail price
price_list
id
Price list which includes this product
discount_percentage
float
(retail_price-price)/retail_price)*100
extra_field
Json
Campaign and discount info regarding the price
modified_date
datetime
Last modified date of the product price
created_date
datetime
Shows the date when the product price was created
“count” shows how many product prices exist in the system.
“next” shows the next cursor url to retrieve the desired product prices.
“previous” shows the previous page url to retrieve the desired product prices.
“results” shows every product price property with detailed field descriptions for the current page.
Create or Update Product Price
This service has the upsert logic. If the price list has the product SKU, the price of the product will be updated with the given parameters. If there is no product SKU available in the price list, a price will be created in the list with the product SKU.
To create or update the price of the product, it is necessary to know the ID of the price list. How to get the price list ID and other details are explained under this section.
Parameter
Data Type
Description
id
id
Product Price ID
product
id string
Related product ID (product_sku for i1)
price
float
Sale price
price_list
id
Price list which includes this product
currency_type
string enum
Currency unit
tax_rate
float
Body
retail_price
float
Retail price
discount_percentage
float
(retail_price-price)/retail_price)*100
extra_field
Json
Campaign and discount info for regarding price
Request POST
POST request is used to create a new product price object. ‘Product’ and ‘price_list’ are unique_together fields.
‘content_type’ header represents the response type.
‘Authorization’ header is a required header for authentication. You can retrieve api_token with login.
Path: i1/product_price/
Response
Returns the created object data after successfully creating the object. Successful response status is expected to be HTTP-201 Created.
Resource properties are in Python format.
Property
Data Type
Description
id
integer
ID number of product price
product_sku
string
Product SKU
price
float
Product price
currency_type
string enum
Currency of the price field, default currency is ‘try’
tax_rate
float
Ad valorem tax rate (Ex: 18.00)
retail_price
float
Retail price
price_list
id
Price list which includes this product
extra_field
Json
Campaign and discount info for regarding price
Bad Request Responses
When the requested action cannot be executed, API gives an explanation about the request.
When creating a product price, product
and price_list
combination should be unique. Otherwise, the below error appears (‘product’ and ‘price_list’ are unique_together fields).
name
and code
fields should be unique.
Bulk Create or Update Product Price
This service has the same logic as the Create or Update Product Price Service. The only difference is that this service accepts a maximum of 10 instances to be updated or created at a time. It also accepts batch_id
as a parameter which is described in the table below.
Parameter
Data Type
Description
Required
product__sku
string
Product SKU field
YES
price
float
Sale price
YES
price_list
id
Price list which includes this product
YES
currency_type
string enum
Currency unit
NO. Default is ‘try’
tax_rate
float
Body
NO
retail_price
float
Retail price
NO
discount_percentage
float
(retail_price-price)/retail_price)*100
NO
extra_field
Json
Campaign and discount info regarding the price
NO
batch_id
string
Enables to track your actions. The value does not insert in the Omnitron Database. It will return in the response.
NO
Request POST
POST request is used to create a new product price object. ‘Product’ and ‘price_list’ are unique_together fields.
‘content_type’ header represents the response type.
‘Authorization’ header is a required header for authentication. You can retrieve api_token with login.
Path: /api/i1/product_price/bulk_upsert/
Response
Returns each object status information. Successful response status is expected to be HTTP-200 Successful.
Resource properties are in Python format.
Property
Data Type
Description
product__sku
string
Product SKU
created_or_updated
boolean
True means Product Price is created. False means Product Price is updated.
success
boolean
Shows whether the operation is successfully completed or not.
batch_id
string
Given batch_id
errors
string
If the operation has failed, it shows the reason.
Last updated
Was this helpful?