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

Orders

This page contains the documentation for the orders endpoints.

PreviousAddressNextStatistics

Last updated 6 months ago

The orders endpoints allow you to view your current orders. You can also add, modify and delete your orders with these endpoints.

  • GETGet all Orders
  • POSTAdd an Order
  • POSTEdit Orders
  • POSTDelete Orders

Get all Orders

get

This endpoint allows you to get the orders of the user. Order can either be:

  • pending: Order is in the pending state. It has not been delivered.
  • delivery: Order is in the delivery state. It is still in shipment and not completed.
  • completed: Order is completed an finalized.

To change the status of an order, use the POST Edit Orders endpoint.

Authorizations
Responses
200
Successful response. Returns all of the user's orders.
application/json
400
See message description.
500
see message description.
get
GET /orders/get_all HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Accept: */*
[
  {
    "orderId": "674b37b8dc3d9360b4c32e72",
    "productId": "6555a1f49feeac7dccd9b1ee",
    "image": "1700110836527.webp",
    "name": "brown tablede",
    "price": 30,
    "quantity": 4,
    "shipping": "Regular",
    "status": "pending",
    "createdAt": "November 30, 2024",
    "orderNum": 1
  },
  {
    "orderId": "674b37b8dc3d9360b4c32e72",
    "productId": "655ff05e60b5a0bcc0a9314e",
    "image": "1700786270864.webp",
    "name": "Regular table",
    "price": 100,
    "quantity": 4,
    "shipping": "Regular",
    "status": "pending",
    "createdAt": "November 30, 2024",
    "orderNum": 1
  }
]

Add an Order

post

This endpoint allows users to create a new order by providing the list of items they want to purchase along with the shipping address.

  • Each item must include the product ID, quantity, and shipping type.
  • The address field specifies the delivery address for the order.
Authorizations
Body
addressstringRequired

Delivery address for the order.

Responses
200
Successful response. The order has been created successfully.
text/plain
ResponsestringExample: ORDER SUCCESS
400
See message description.
500
see message description.
post
POST /orders/add HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 215

{
  "items": [
    {
      "product": "655ff05e60b5a0bcc0a9314e",
      "quantity": 15,
      "shipping": "Regular"
    },
    {
      "product": "656427ab575db1ee43d46b57",
      "quantity": 10,
      "shipping": "Regular"
    }
  ],
  "address": "Post Office Pl, Carlton VIC 3053, Australia"
}
ORDER SUCCESS

Edit Orders

post

This endpoint allows users to update the status of one or more orders. Valid status values include:

  • pending: The order has not been delivered.
  • delivery: The order is in shipment.
  • completed: The order is finalized and delivered.

Users must provide the orderId and the new status for each order.

Authorizations
Body
Responses
200
Successful response. Returns the updated orders with their details.
application/json
400
See message description.
500
see message description.
post
POST /orders/change-status HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 130

{
  "items": [
    {
      "orderId": "674b46f1dc3d9360b4c32ee2",
      "status": "delivery"
    },
    {
      "orderId": "674b46a8dc3d9360b4c32ede",
      "status": "completed"
    }
  ]
}
[
  {
    "_id": "674b46a8dc3d9360b4c32ede",
    "user": "672050a27def4d23ffcb5166",
    "items": [
      {
        "product": "6555a1f49feeac7dccd9b1ee",
        "quantity": 4,
        "shipping": "Regular",
        "_id": "674b46a8dc3d9360b4c32edf"
      },
      {
        "product": "6555a2779feeac7dccd9b201",
        "quantity": 3,
        "shipping": "Regular",
        "_id": "674b46a8dc3d9360b4c32ee0"
      }
    ],
    "status": "completed"
  }
]

Delete Orders

post

This endpoint allows users to delete one or more orders.

  • Users must provide the orderId of each order to be deleted.
  • The response confirms whether the operation was successful and the number of orders deleted.
Authorizations
Body
orderIdstring[]Required

List of order IDs to be deleted.

Responses
200
Successful response. Confirms the number of deleted orders.
application/json
400
See message description.
500
see message description.
post
POST /orders/delete HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 67

{
  "orderId": [
    "674b46f1dc3d9360b4c32ee2",
    "674b46a8dc3d9360b4c32ede"
  ]
}
{
  "acknowledged": true,
  "deletedCount": 2
}