Orders

This page contains the documentation for the orders endpoints.

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

Get all Orders

get
/orders/get_all

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
AuthorizationstringRequired

Provide your API key.

Responses
200

Successful response. Returns all of the user's orders.

application/json
get
/orders/get_all
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
/orders/add

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
AuthorizationstringRequired

Provide your API key.

Body
addressstringRequired

Delivery address for the order.

Responses
200

Successful response. The order has been created successfully.

text/plain
ResponsestringExample: ORDER SUCCESS
post
/orders/add
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
/orders/change-status

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.

Required scopes
This endpoint requires the following scopes:
Authorizations
AuthorizationstringRequired

Provide your API key.

Body
Responses
200

Successful response. Returns the updated orders with their details.

application/json
post
/orders/change-status
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
/orders/delete

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
AuthorizationstringRequired

Provide your API key.

Body
orderIdstring[]Required

List of order IDs to be deleted.

Responses
200

Successful response. Confirms the number of deleted orders.

application/json
post
/orders/delete
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
}

Last updated