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

Statistics

This page contains the documentation for the statistics endpoints.

PreviousOrders

Last updated 6 months ago

The statistics endpoints allow you to get the statistics of the users, products and orders. These metrics give you insights to the number of users, the most ordered items, and the status of the different orders.

Get User Stats

get

This endpoint provides a summary of key metrics for the users shown in the admin dashboard, including:

  • Total orders and their statuses (pending, delivery, and completed).
  • Total users and total products. Each metric includes a text label, count, and a link for further details.
Authorizations
Responses
200
Successful response. Returns a summary of dashboard statistics.
application/json
400
See message description.
500
see message description.
get
GET /stats/dashboard HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Accept: */*
[
  {
    "text": "All orders",
    "count": 49,
    "link": "orders"
  },
  {
    "text": "Pending orders",
    "count": 22,
    "link": "orders/pending"
  },
  {
    "text": "Delivered orders",
    "count": 12,
    "link": "orders/delivery"
  },
  {
    "text": "Completed orders",
    "count": 15,
    "link": "orders/completed"
  },
  {
    "text": "Total users",
    "count": 58,
    "link": "users"
  },
  {
    "text": "Total products",
    "count": 8,
    "link": "products"
  }
]

Get Product Stats

get

This endpoint retrieves product statistics for the specified page, including:

  • Total products sold (soldCount).
  • Breakdown of product orders by status (pending, delivery, completed) with counts and total quantities.
Authorizations
Path parameters
pageinteger ยท min: 1Required

The page number for paginated product statistics.

Responses
200
Successful response. Returns a paginated list of product statistics.
application/json
400
See message description.
500
see message description.
get
GET /stats/productTable/{page} HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Accept: */*
[
  {
    "product": "6555a1f49feeac7dccd9b1ee",
    "name": "brown tablede",
    "soldCount": 90,
    "counts": {
      "delivery": {
        "count": 6,
        "totalQuantity": 12
      },
      "completed": {
        "count": 7,
        "totalQuantity": 30
      },
      "pending": {
        "count": 13,
        "totalQuantity": 74
      }
    }
  },
  {
    "product": "655ff05e60b5a0bcc0a9314e",
    "name": "Regular table",
    "soldCount": 31,
    "counts": {
      "delivery": {
        "count": 1,
        "totalQuantity": 1
      },
      "completed": {
        "count": 2,
        "totalQuantity": 2
      },
      "pending": {
        "count": 4,
        "totalQuantity": 11
      }
    }
  }
]

Get Order Stats

get

This endpoint retrieves order statistics for the specified page.

Authorizations
Path parameters
pageintegerRequired

The page number for pagination.

Example: 1
Responses
200
A list of orders.
application/json
400
See message description.
500
see message description.
get
GET /stats/orders/all/{page} HTTP/1.1
Host: thefurniturebros.com
Authorization: YOUR_API_KEY
Accept: */*
{
  "totalOrders": 49,
  "orders": [
    {
      "_id": "674b37b8dc3d9360b4c32e72",
      "user": {
        "_id": "672050a27def4d23ffcb5166",
        "email": "first123_29@gmail.com"
      },
      "items": [
        {
          "product": {
            "_id": "6555a1f49feeac7dccd9b1ee",
            "name": "brown tablede",
            "price": 30
          },
          "quantity": 4,
          "shipping": "Regular",
          "_id": "674b37b8dc3d9360b4c32e73"
        }
      ],
      "status": "pending",
      "address": "Tester Dr, Blackwood SA 5051, Australia",
      "createdAt": "30 Nov 2024",
      "__v": 0
    }
  ]
}
  • GETGet User Stats
  • GETGet Product Stats
  • GETGet Order Stats