Products Endpoint
TIP
Refer to products page for Base URL
* Add Product
Endpoint: POST
admin/productRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | * | Firebase access token | ✔️ |
Payload Description
| Name | Type | Description | Required |
|---|---|---|---|
| name | string | name should be descriptive | ✔️ |
| description | string | short description -255 characters | ❌ |
| price | float | selling price eg. 50.99 | ✔️ |
| quantity | number or int | number of products available ~ 1 by default | ✔️ |
| discountPercent | number or int | item discount percent eg. 10.59% | ❌ |
| specification | string ~ rich text | rich text content | ❌ |
| mainCategory | uuid | main category uuid | ✔️ |
| subCategory | uuid | sub category uuid | ✔️ |
| productCategory | uuid | product category uuid | ✔️ |
| brand | uuid | product brand uuid | ❌ |
| sizes | array of strings | eg. L, XL, S | ❌ |
| store | string | store id | ✔️ |
| colors | array of object | color code & name | ❌ |
| images | empty array | images has it's own endpoint | ✔️ |
Sample Payload
{
"name": "try me",
"description": "Casual clothes for boys",
"price": 58.99,
"quantity": 10,
"brand": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"discountPercent": 5.00,
"specifications": "<strong>Neat Shirt</strong>",
"mainCategory": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"subCategory": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"productCategory": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"sizes": [
"L",
"XL"
],
"store": "00ad763e-a204-410a-8ea1-f4696ba97d0b",
"colors": [
{
"name": "red",
"code": "#ff00"
}
],
"images": [ ]
}Sample Response
{
"brand": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"mainCategory": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"subCategory": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"productCategory": "bde478ca-7470-4616-b3e7-cbace9bb2b81",
"store": "00ad763e-a204-410a-8ea1-f4696ba97d0b",
"name": "T-Shirt",
"description": "Casual clothes for boys",
"price": 58.99,
"quantity": 10,
"creatorId": "gxxjx22P3eNvGjvenIkvCjEkxh63",
"discountPercent": 5.0,
"specifications": "<strong>Neat Shirt</strong>",
"sizes": [
"L",
"XL"
],
"slug": "t-shirt"
}* Add Product Images
Endpoint: POST
admin/product/images/Request Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | * | Firebase access token | ✔️ |
| Content-Type | 'multipart/form-data' | multipart/form-data | ✔️ |
Payload Description
| Name | Type | Description | Required |
|---|---|---|---|
| image | composite | binary formate file | ✔️ |
| productID | string | product id | ✔️ |
Sample Payload
{
"image": "****************************",
"productID": "30875d74-712a-4501-a0f6-65d06eccc574"
}Sample Response
{
status=201
}Sample Response
* List Products
Endpoint: GET
admin/productsRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | **** | Firebase access token | ✔️ |
Parameters
Not required
Sample Response
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"images": [
"http://127.0.0.1:8000/media/products/2023-07-25/252903747_410898053822974_7209345822968452321_n.jpg"
],
"name": "T-Shirt",
"price": "34.00",
"discountPercent": "1.00",
"slug": "t-shirt"
}
]
}* Update Product
Endpoint: PATCH | PUT
admin/product/pkRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | * | Firebase access token | ✔️ |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| pk | string | product id | ✔️ |
Sample Request
admin/product/b9110ba6-5f0e-452b-be71-6b6a901ca7c2Sample Payload
{
"name": "New Product Name",
"salePrice": "34.00"
}Sample Response
{
"brand": "ASOS",
"colors": [
{
"code": "#000",
"name": "Black"
},
{
"code": "#fff",
"name": "White"
}
],
"description": "<p>Casual clothes for boys</p>",
"discount": true,
"features": "<strong>Neat Shirt</strong>",
"inStock": true,
"quantity": 10,
"mainCategory": "Men",
"name": "New Product Name",
"salePrice": "34.00"
"originalPrice": "58.99",
"productCategory": "Shirts",
"sizes": [
"L",
"XL"
],
"subCategory": "Boys Clothing",
"specifications": "<strong>Neat Shirt</strong>"
}* Delete Product ~ Temporary
Endpoint: DELETE
admin/product/delete/pkRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | **** | Firebase access token | ✔️ |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| pk | string | product id | ✔️ |
Sample Request
admin/product/delete/b9110ba6-5f0e-452b-be71-6b6a901ca7c2Sample Response
{
data="product deleted",
status=204 No Content
}* Delete Product ~ Permanently
Useful initial creating of product fails
Endpoint: DELETE
admin/product/delete/permanent/pkRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | * | Firebase access token | ✔️ |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| pk | string | product id | ✔️ |
Sample Request
admin/product/delete/permanent/b9110ba6-5f0e-452b-be71-6b6a901ca7c2Sample Response
{
status=204 No Content
}* Add Promotion
Endpoint: POST
admin/promotionsRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | * | Firebase access token | ✔️ |
Payload Description
| Name | Type | Description | Required |
|---|---|---|---|
| name | string | name should be descriptive | ✔️ |
| description | string | short description -255 characters | ✔️ |
| price | float | price eg. 50.99 | ✔️ |
| quantity | number or int | number of products for promotion | ✔️ |
| duration | number or int | promotion period | ✔️ |
Sample Payload
{
"name": "Xmas2",
"description": "Casual clothes for boys",
"price": 38.99,
"quantity": 10,
"duraion": 5
}Sample Response
{
"id": "fac497a5-9057-4e97-afd2-6ca10c533cce",
"dateCreated": "2023-08-05T17:52:48.745542Z",
"dateUpdated": "2023-08-05T17:52:48.745542Z",
"name": "Xmas2",
"description": "Casual clothes for boys",
"price": "38.99",
"quantity": 10,
"duration": 1
}* List Promotion
Endpoint: GET
admin/promotionsRequest Headers
| Authorization | Value | Description | Required |
|---|---|---|---|
| Bearer | * | Firebase access token | ✔️ |
Sample Response
[
{
"id": "67a52f33-8ba0-4dab-a7f4-d8070b4e1ef5",
"dateCreated": "2023-08-04T22:25:30.342124Z",
"dateUpdated": "2023-08-04T22:25:30.342124Z",
"name": "Testing",
"description": "testing it out",
"price": "12.00",
"quantity": 12,
"duration": 23
},
]
Wookein Docs