Skip to content

Products Endpoint

TIP

Refer to products page for Base URL

* Add Product

Endpoint: POST

admin/product

Request Headers

AuthorizationValueDescriptionRequired
Bearer*Firebase access token✔️

Payload Description

NameTypeDescriptionRequired
namestringname should be descriptive✔️
descriptionstringshort description -255 characters
pricefloatselling price eg. 50.99✔️
quantitynumber or intnumber of products available ~ 1 by default✔️
discountPercentnumber or intitem discount percent eg. 10.59%
specificationstring ~ rich textrich text content
mainCategoryuuidmain category uuid✔️
subCategoryuuidsub category uuid✔️
productCategoryuuidproduct category uuid✔️
branduuidproduct brand uuid
sizesarray of stringseg. L, XL, S
storestringstore id✔️
colorsarray of objectcolor code & name
imagesempty arrayimages 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

AuthorizationValueDescriptionRequired
Bearer*Firebase access token✔️
Content-Type'multipart/form-data'multipart/form-data✔️

Payload Description

NameTypeDescriptionRequired
imagecompositebinary formate file✔️
productIDstringproduct id✔️

Sample Payload

{
  "image": "****************************",
  "productID": "30875d74-712a-4501-a0f6-65d06eccc574"
}

Sample Response

{
  status=201
}

Sample Response

* List Products

Endpoint: GET

admin/products

Request Headers

AuthorizationValueDescriptionRequired
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/pk

Request Headers

AuthorizationValueDescriptionRequired
Bearer*Firebase access token✔️

Parameters

NameTypeDescriptionRequired
pkstringproduct id✔️

Sample Request

admin/product/b9110ba6-5f0e-452b-be71-6b6a901ca7c2

Sample 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/pk

Request Headers

AuthorizationValueDescriptionRequired
Bearer****Firebase access token✔️

Parameters

NameTypeDescriptionRequired
pkstringproduct id✔️

Sample Request

admin/product/delete/b9110ba6-5f0e-452b-be71-6b6a901ca7c2

Sample Response

{
  data="product deleted",
  status=204 No Content
}

* Delete Product ~ Permanently

Useful initial creating of product fails

Endpoint: DELETE

admin/product/delete/permanent/pk

Request Headers

AuthorizationValueDescriptionRequired
Bearer*Firebase access token✔️

Parameters

NameTypeDescriptionRequired
pkstringproduct id✔️

Sample Request

admin/product/delete/permanent/b9110ba6-5f0e-452b-be71-6b6a901ca7c2

Sample Response

{
  status=204 No Content
}

* Add Promotion

Endpoint: POST

admin/promotions

Request Headers

AuthorizationValueDescriptionRequired
Bearer*Firebase access token✔️

Payload Description

NameTypeDescriptionRequired
namestringname should be descriptive✔️
descriptionstringshort description -255 characters✔️
pricefloatprice eg. 50.99✔️
quantitynumber or intnumber of products for promotion✔️
durationnumber or intpromotion 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/promotions

Request Headers

AuthorizationValueDescriptionRequired
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
  },
]

Released under the MIT License.