The Furniture Bros API docs
  • Start here
    • Introduction
    • Get Started
    • Authentication
    • Making a request
    • Examples
    • Functionalities
    • Release Notes
      • 5 Dec 2024
      • 4 Dec 2023
      • 30 Nov 2023
      • 24 Nov 2023
      • 20 Nov 2023
      • 14 Nov 2023
      • 26 Oct 2023
      • 23 Oct 2023
      • 05 Oct 2023
    • Glossary
      • API terms
      • Functionality terms
  • API Endpoints
    • Account
    • Product
    • Cart
    • Address
    • Orders
    • Statistics
Powered by GitBook
On this page
  1. API Endpoints

Cart

This page contains the documentation for the cart endpoints.

PreviousProductNextAddress

Last updated 6 months ago

The cart endpoints allow you to add items in your cart and look at what you currently have in there. You can also modify the number of items and remove items in the cart.

  • POSTAdd Items to Cart
  • GETGet Cart Items
  • PUTEdit Cart Items
  • DELETERemove Items from Cart

Get Cart Items

get

This endpoint allows you get the current items in your cart.

Authorizations
Responses
200
Successful response. Returns the list of items in your cart.
application/json
400
See message description.
500
see message description.
get
GET /cart/items HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Accept: */*
{
  "_id": "6556aed27e6cd0b318dbb08d",
  "user": {
    "_id": "6555a0f89feeac7dccd9b1dd",
    "name": "first account",
    "email": "first_account@gmail.com"
  },
  "items": [
    {
      "product": {
        "_id": "6555a2269feeac7dccd9b1f2",
        "name": "White desk",
        "image": "1700110886749.webp",
        "price": 60,
        "description": "Maecenas at justo eu eros ultrices vulputate vitae at augue.",
        "soldCount": 99,
        "__v": 0
      },
      "quantity": 20,
      "_id": "67498e75990ee7506c8ee954"
    },
    {
      "product": {
        "_id": "655fefee60b5a0bcc0a9313c",
        "name": "stool",
        "image": "1700786158091.webp",
        "price": 60,
        "description": "Umde",
        "soldCount": 1,
        "__v": 0
      },
      "quantity": 25,
      "_id": "67498e82990ee7506c8ee958"
    }
  ],
  "__v": 100
}

Add Items to Cart

post

This endpoint allows you add items to your cart.

Authorizations
Body
productIdstringRequired

The ID of the product. You can use the GET Product list endpoint to view available products and it's ID.

quantityintegerRequired

The quantity of items to add.

Responses
200
Successful response. Returns the result of the operation.
text/plain
Responsestring

Successful operation.

Example: POST REQUEST SUCCESS
400
See message description.
500
see message description.
post
POST /cart/add HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 54

{
  "productId": "6555a1f49feeac7dccd9b1ee",
  "quantity": 20
}
POST REQUEST SUCCESS

Edit Cart Items

put

This endpoint allows you to update the quantity of a product in the cart.

Authorizations
Body
productIdstringRequired

Unique identifier of the product to update.

quantityintegerRequired

New quantity of the product.

Responses
200
Successful response. Returns the items in the cart.
application/json
400
See message description.
500
see message description.
put
PUT /cart/edit HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 54

{
  "productId": "655fefee60b5a0bcc0a9313c",
  "quantity": 40
}
{
  "_id": "6556aed27e6cd0b318dbb08d",
  "user": "6555a0f89feeac7dccd9b1dd",
  "items": [
    {
      "product": "6555a2269feeac7dccd9b1f2",
      "quantity": 30,
      "_id": "67498e75990ee7506c8ee954"
    },
    {
      "product": "655fefee60b5a0bcc0a9313c",
      "quantity": 40,
      "_id": "67498e82990ee7506c8ee958"
    }
  ],
  "__v": 100
}

Remove Items from Cart

delete

This endpoint allows you to delete specified items from the user's cart.

Authorizations
Body
itemsstring[]Optional

List of product IDs to remove from the cart.

Responses
200
Successful response. Returns the updated cart after deletion.
application/json
400
See message description.
500
see message description.
delete
DELETE /cart/delete HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 38

{
  "items": [
    "67498e75990ee7506c8ee954"
  ]
}
{
  "_id": "6556aed27e6cd0b318dbb08d",
  "user": "6555a0f89feeac7dccd9b1dd",
  "items": [
    {
      "product": "655fefee60b5a0bcc0a9313c",
      "quantity": 40,
      "_id": "67498e82990ee7506c8ee958"
    },
    {
      "product": "65653baad868691c42306f7f",
      "quantity": 41,
      "_id": "6749904c990ee7506c8ee97d"
    }
  ],
  "__v": 101
}