Basket

Api docs for Basket.

GET /basket/

Get basket.

{
    "id": 1,
    "items": [],
    "subtotal": "0.00",
    "extra_rows": [],
    "total": "0.00",
    "extra": {}
}
POST /basket/

Add an item to the basket. To add the same product with a different configuration to the basket you can send a custom ref parameter. Otherwise a default one is auto-generated.

Query Parameters
  • basket (str) – pass in ?basket to return an updated basket after the operation.

JSON Parameters
  • ref (str) – unique item reference, default is slugified product_type-product_id

  • product_type (str) – type formated as app_name.Model

  • product_id (int) – instance id

  • quantity (int) – item quantity, default is 1

  • extra (json) – extra data for basket item, optional

Status Codes
DELETE /basket/

Delete basket.

Query Parameters
  • basket (str) – pass in ?basket to return an updated basket after the operation.

Status Codes
GET /basket/count/

Show basket item count.

{
    "count": 3
}
GET /basket/quantity/

Show basket total quantity.

{
    "quantity": 9
}
POST /basket/clear/

Clear all items from basket.

Query Parameters
  • basket (str) – pass in ?basket to return an updated basket after the operation.

GET /basket/extra/

Get basket extra data.

{
    "extra": {}
}
PUT /basket/extra/

Update basket extra data.

Query Parameters
  • basket (str) – pass in ?basket to return an updated basket after the operation.

JSON Parameters
  • extra (json) – update item extra, null values are removed

Status Codes
GET /basket/(str: ref)/

Get basket item.

Parameters
  • ref (str) – basket item ref

{
    "url": "http://localhost:8000/api/basket/shopproduct-1/",
    "ref": "shopproduct-1",
    "product_type": "shop.Product",
    "product_id": 1,
    "product": {
        "name": "Product",
        "code": "1"
    },
    "unit_price": "33.00",
    "quantity": 1,
    "subtotal": "33.00",
    "extra_rows": [],
    "total": "33.00",
    "extra": {}
}
PUT /basket/(str: ref)/

Update basket item.

Parameters
  • ref (str) – basket item ref

Query Parameters
  • basket (str) – pass in ?basket to return an updated basket after the operation.

JSON Parameters
  • quantity (int) – update item quantity

  • extra (json) – update item extra, null values are removed

Status Codes
DELETE /basket/(str: ref)/

Remove item from basket.

Parameters
  • ref (str) – basket item id

Query Parameters
  • basket (str) – pass in ?basket to return an updated basket after the operation.

Status Codes