API: Products
Table of Contents
There are 3 API endpoints in the Enapps ERP API for products:
-
/products/get_basic - this is a quick listing of all the products (1000 per page).
USE CASE: It is recommended that the result of this query to be stored at EDI/E-commerce databases locally with regular re-syncs. -
/products/get_full - this is a more detailed listing of certain products (max 10 at a time), which returns real-time pricing and availability. This API call disregards any product variation and quantity breaks for the pricing and availability computations.
USE CASE: This API call could be used on e-commerce portals to retrieve and display upto 10 product listing per page and their real-time one off pricing/availability. -
/products/get_detail - this is a detailed price and availability information for a single product and it accepts quantity and variations (Product Parameter) as API input parameter.
USE CASE: It is recommended that this API is used to display pricing and availability information for logged in customers while at the product page. The same API call would be invoked when the customer changes the quantity/parameters, which in many cases could result in a different price.
Base URL |
https://<server>:<port>/api/v1 |
/products/get_basic
Endpoint | /products/get_basic |
---|---|
Method | GET |
Request parameters | |||
---|---|---|---|
Name | Type | Required | Description |
page | integer |
No |
Optional pagination parameter. |
Response parameters | ||
Name | Type | Description |
id | integer | Product unique ID |
default_code | integer | Product unique SKU |
name | string | Product name |
family_id | array() | Product category ID : product category name |
list_price | numeric | Default sale price |
parameter_ids | JSON dictionary |
JSON dictionary contains:
|
web_category_ids | array() | List of product web-categories (if any): [name], [product web-category ID] (available only for products synced to online website) |
currency | string | Currency 3-letter code |
Example | |
HTTP |
GET /api/v1/products/get_basic HTTP/1.1 Host: company.erp.zone:4095 Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODk0MDI3NjgsInQiOiJhY2Nlc3MiLCJsIjoid29vY29tbWVyY2VhcGkiLCJkYiI6InByb2R1Y3Rpb25fZGV2In0.w3JEJ8A5LPUnnJbrv0lIPi57wj0bif1r5S5AxBCKZS0 |
/products/get_full
Endpoint | /products/get_full |
---|---|
Method | GET |
Request parameters | |||
Name | Type | Required | Description |
product_ids | array/list | Yes |
Ids of required products as a comma separated list. i.e. [123,124,155] Maximum 10 product_ids per 1 request. |
partner_id | integer | No |
ID of a partner (Accounting→Customers→Select one and find in the right bottom corner of your screen, e.g. res.partner #12458) to apply customer-specific configurations (e.g. price, availability) |
additional_fields | array/list | No |
Provide field names of additional fields not part of the standard Endpoint. For more information please refer to Additional Fields |
Response parameters | ||
Name | Type | Description |
id | integer | Product unique ID |
list_price | float | Default sale listing price |
available_to_sell | integer | Overall product stock availability |
currency | string | Currency 3-letter code |
Examples | |
HTTP |
GET /api/v1/products/get_full?product_ids=[23833,23619,23621,23623,23625,23627,23629,23631,23633,23635] HTTP/1.1 Host: company.erp.zone:4095 Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODk0MDI3NjgsInQiOiJhY2Nlc3MiLCJsIjoid29vY29tbWVyY2VhcGkiLCJkYiI6InByb2R1Y3Rpb25fZGV2In0.w3JEJ8A5LPUnnJbrv0lIPi57wj0bif1r5S5AxBCKZS0 |
/products/get_detail
Endpoint | /products/get_detail |
---|---|
Method | GET |
Request parameters | |||
Name | Type | Required | Description |
partner_id | integer | Yes |
ID of a partner (Accounting→Customers→Select one and find in the right bottom corner of your screen, e.g. res.partner # 111) to apply customer-specific configurations (e.g. price) |
product_id | integer | Yes |
Product unique ID |
parameters | JSON dictionary | No |
A list of option_types as elements within the array.
Example: if there are 3 parameters in a product (e.g. “Colour”, "Size", "Material"). Each parameter has many option types. So there should only be 3 option_types provided for this specific product (each one corresponding to related parameter type).
JSON example: { "Colour":"Red", "Size":"Large", "Material":"Cotton" }
Note: if not specified, the system will use ERP defaults. |
qty | numeric | No |
The amount of product required to calculate the price. If not specified - defaults to 1. |
additional_fields | array/list | No |
Provide field names of additional fields not part of the standard Endpoint. For more information please refer to Additional Fields |
Response parameters | ||
Name | Type | Description |
id | integer | Product unique ID |
list_price | float | Calculated sale price for a specific “partner_id”, specified quantity and parameters provided |
available_to_sell | string | Product quantity available in stock for sale |
currency | string | Currency 3-letter code |
Examples | |
HTTP |
GET api/v1/products/get_full?product_ids=[312]¶meters={"Colour":"Red", "Frame":"White", "Outer Colour":"Black"}&partner_id=1&qty=50 HTTP/1.1 Host: company.erp.zone:4095 Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODk0MDI3NjgsInQiOiJhY2Nlc3MiLCJsIjoid29vY29tbWVyY2VhcGkiLCJkYiI6InByb2R1Y3Rpb25fZGV2In0.w3JEJ8A5LPUnnJbrv0lIPi57wj0bif1r5S5AxBCKZS0 |