Products
This page provides comprehensive information and documentation on a set of API methods specifically designed to handle products.
Products
Products can be created multiple ways.
- Marketplace Owners can directly create products.
- Sellers can create products by firstly creating a pre-offer. This process depends on Marketplace Owners' approval.
The marketplace owner is responsible for managing the products.
Schema
{
"id": "uuid",
"name": "string",
"base_code": "string",
"sku": "string",
"category": "uuid Ref(Category ID)",
"attributes": "dict",
"meta": "uuid Ref(Meta Product ID)",
"created_at": "datetime",
"updated_at": "datetime"
}
Retrieve PRI01
curl -X GET "https://example.com/api/i1/products/" \
-H "Content-Type: application/json" \
-H "Authentication: Bearer {TOKEN}"
Example Response
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "29422ca8-fbaa-48a9-b039-291960fa3fcd",
"name": "Sample Product",
"base_code": "SP-A",
"sku": "SP-A",
"category": "7cbbb704-d86e-4dd2-a962-9dab078d9ff3",
"attributes": {"foo": "bar", "baz": "qux"},
"meta": "e2ebbb76-de1c-4c03-b33a-1ea03db19ebe",
"created_at": "2019-01-01T00:00:00Z",
"updated_at": "2019-01-01T00:00:00Z"
}
]
}
Available Query Parameters
Key | Type |
---|---|
name | string |
name__contains | string |
name__icontains | string (case-insensitive) |
base_code | string |
base_code__contains | string |
base_code__icontains | string (case-insensitive) |
sku | string |
sku__contains | string |
sku__icontains | string (case-insensitive) |
category | string |
category__contains | string |
attributes__{KEY} | string |
attributes{KEY}contains | string |
attributes{KEY}startswith | string |
attributes{KEY}endswith | string |
attributes{KEY}isnull | boolean |
created_at__gte | datetime |
created_at__gt | datetime |
created_at__lte | datetime |
created_at__lt | datetime |
updated_at__gte | datetime |
updated_at__gt | datetime |
updated_at__lte | datetime |
updated_at__lt | datetime |
Possible HTTP Status Codes
- 200 OK: Products retrieved successfully.
- 401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
- 415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
- 500 Internal Server Error: Unexpected server error.
Product Offers
Product Offers are the relation layers between Sellers pre-offers and Marketplace's products. After a pre-offer is created by Seller and approved by Marketplace Owner, a product-offer is generated.
Product offer has both product and seller information in it, which are product_id, datasource_id, price, stock, offer attributes
etc.
Product offers are managed by the Sellers and can be updated, deleted, and read by them.
Schema
{
"id": "uuid",
"sku": "string",
"product": "uuid (Ref: Product ID)",
"attributes": {
"key": "value"
},
"status": "enum(Active > 1, Passive > 0)",
"created_at": "datetime",
"updated_at": "datetime"
}
Retrieve POI01
curl -X GET "https://example.com/api/i1/product-offers/" \
-H "Content-Type: application/json" \
-H "Authentication: Bearer {TOKEN}"
Example Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "d58fad2d-2ac0-48c3-8207-f546b4fb045c",
"sku": "MA-SP-A-1",
"product": "29422ca8-fbaa-48a9-b039-291960fa3fcd",
"attributes": {
"baz": "qux"
},
"status": 1,
"created_at": "2019-01-01T00:00:00Z",
"updated_at": "2019-01-01T00:00:00Z"
}
]
}
Available Query Parameters
Key | Type |
---|---|
sku | string |
sku__contains | string |
sku__icontains | string (case-insensitive) |
status | integer |
attributes__{KEY} | string |
attributes{KEY}contains | string |
attributes{KEY}startswith | string |
attributes{KEY}endswith | string |
attributes{KEY}isnull | boolean |
created_at__gte | datetime |
created_at__gt | datetime |
created_at__lte | datetime |
created_at__lt | datetime |
updated_at__gte | datetime |
updated_at__gt | datetime |
updated_at__lte | datetime |
updated_at__lt | datetime |
Possible HTTP Status Codes
- 200 OK: Product Offers retrieved successfully.
- 401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
- 415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
- 500 Internal Server Error: Unexpected server error.
Delete POI02
curl -X DELETE 'https://example.com/api/i1/product-offers/{SKU}/' \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json'
Possible HTTP Status Codes
- 204 No Content: Product Offer passivated successfully.
- 401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
- 404 Not Found: Product Offer with given SKU does not exist.
- 415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
- 500 Internal Server Error: Unexpected server error.
Product Prices
A Product Price represents the price details of a specific product that is being sold by a seller.
The price details are managed by the seller and can be updated, deleted, and read by them.
Schema
{
"id": "uuid",
"sku": "string (Ref: Product SKU)",
"price_list": "uuid (Ref: Price List ID)",
"retail_price": "decimal",
"price": "decimal",
"currency_type": "enum(TRY, USD, EUR, EGP, GBP, MAD, PLN, SAR, RON, UAH, CZK, HUF, RUB, BGN, IQD, KWD, BHD, OMR, QAR, AED and NGN)",
"tax_rate": "decimal",
"discount_percentage": "decimal",
"is_active": "boolean",
"created_at": "datetime",
"updated_at": "datetime"
}
Upsert PPI01
If the SKU is not found, a new Product Price will be created. Otherwise, the existing Product Price will be updated with the given values.
curl -X POST 'https://example.com/api/i1/product-prices/' \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"sku": "SP-A",
"price_list": "4f61bf48-7f9f-49a5-b5be-ea55b020e058",
"price": "10.00",
"retail_price": "10.00",
"currency_type": "USD",
"tax_rate": "0.00",
"discount_percentage": "0.00",
"is_active": true
}'
Example Response
{
"id": "50c366e7-68de-4bd1-94ca-4af47a40ff92"
}
Possible HTTP Status Codes
200 OK: Product Price created/updated successfully.
400 Bad Request: Invalid request body (missing required fields, invalid format, etc.).
If the request body contain missing required fields, the response will be in the following format:
{
"field": [
"This field is required."
],
"code": "invalid"
}
401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
500 Internal Server Error: Unexpected server error.
Retrieve PPI02
curl -X GET "https://example.com/api/i1/product-prices/" \
-H "Content-Type: application/json" \
-H "Authentication: Bearer {TOKEN}"
Example Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "50c366e7-68de-4bd1-94ca-4af47a40ff92",
"sku": "SP-A",
"price_list": "c5d6b93d-71e3-4694-9068-a64449cd1d21",
"retail_price": "10.00",
"price": "10.00",
"currency_type": "USD",
"tax_rate": "0.00",
"discount_percentage": "0.00",
"is_active": true,
"created_at": "2019-01-01T00:00:00Z",
"updated_at": "2019-01-01T00:00:00Z"
}
]
}
Available Query Parameters
Key | Type |
---|---|
sku | string |
sku__contains | string |
sku__icontains | string (case-insensitive) |
price_list | uuid (Ref: Price List ID) |
retail_price | decimal |
price | decimal |
currency_type | string |
tax_rate | decimal |
discount_percentage | decimal |
price__lt | decimal |
price__gt | decimal |
price__lte | decimal |
price__gte | decimal |
created_at__gte | datetime |
created_at__gt | datetime |
created_at__lte | datetime |
created_at__lt | datetime |
updated_at__gte | datetime |
updated_at__gt | datetime |
updated_at__lte | datetime |
updated_at__lt | datetime |
Possible HTTP Status Codes
- 200 OK: Product Prices retrieved successfully.
- 401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
- 415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
- 500 Internal Server Error: Unexpected server error.
Product Stocks
A Product Stock represents the stock details of a specific product that is being sold by a seller.
The stock details are managed by the seller and can be updated, deleted, and read by them.
Schema
{
"id": "uuid",
"sku": "uuid (Ref: Product SKU)",
"stock_list": "uuid (Ref: Stock List ID)",
"unit_type": "enum(qty, kg)",
"stock": "integer",
"sold_quantity_unreported": "integer",
"is_active": "boolean",
"created_at": "datetime",
"updated_at": "datetime"
}
Upsert PSI01
If the SKU is not found, a new Product Stock will be created. Otherwise, the existing Product Stock will be updated with the given values.
curl -X POST 'https://example.com/api/i1/product-stocks/' \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"sku": "SP-A",
"stock_list": "a9af0aed-5984-43c2-bb72-1886c6f87b2a",
"unit_type": "qty",
"stock": 100,
"sold_quantity_unreported": 0,
"is_active": true
}'
Example Response
{
"id": "e22c16f1-b847-4535-bde4-f42e6ec9947e"
}
Possible HTTP Status Codes
200 OK: Product Stock created/updated successfully.
400 Bad Request: Invalid request body (missing required fields, invalid format, etc.).
If the request body contain missing required fields, the response will be in the following format:
{
"field": [
"This field is required."
],
"code": "invalid"
}
401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
500 Internal Server Error: Unexpected server error.
Retrieve PSI02
curl -X GET "https://example.com/api/i1/product-stocks/" \
-H "Content-Type: application/json" \
-H "Authentication: Bearer {TOKEN}"
Example Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "e22c16f1-b847-4535-bde4-f42e6ec9947e",
"sku": "SP-A",
"stock_list": "a9af0aed-5984-43c2-bb72-1886c6f87b2a",
"unit_type": "qty",
"stock": 100,
"sold_quantity_unreported": 0,
"is_active": true,
"created_at": "2023-01-01T00:00:00.000Z",
"updated_at": "2023-01-01T00:00:00.000Z"
}
]
}
Available Query Parameters
Key | Type |
---|---|
sku | string |
sku__contains | string |
sku__icontains | string (case-insensitive) |
stock_list | uuid (Ref: Stock List ID) |
unit_type | string |
stock | integer |
stock__lt | integer |
stock__gt | integer |
stock__lte | integer |
stock__gte | integer |
created_at__gte | datetime |
created_at__gt | datetime |
created_at__lte | datetime |
created_at__lt | datetime |
updated_at__gte | datetime |
updated_at__gt | datetime |
updated_at__lte | datetime |
updated_at__lt | datetime |
Possible HTTP Status Codes
- 200 OK: Product Stocks retrieved successfully.
- 401 Unauthorized: Invalid authentication header (missing, invalid value, etc.).
- 415 Unsupported Media Type: Invalid content-type header (missing, invalid format, etc.).
- 500 Internal Server Error: Unexpected server error.