Skip to main content
GET
/
subcategories
curl --location --request GET 'https://api.yourapp.com/subcategories' \
--header 'Accept: application/json'
{
  "success": true,
  "message": "All subcategories retrieved successfully",
  "data": {
    "subcategories": [
      {
        "id": 2,
        "name": "Laptops",
        "description": "Laptop computers and accessories",
        "category": {
          "id": 1,
          "name": "Electronics",
          "description": "Electronic devices and components"
        },
        "created_at": "2024-03-08T10:30:00.000000Z",
        "updated_at": "2024-03-08T10:30:00.000000Z"
      },
      {
        "id": 1,
        "name": "Smartphones",
        "description": "Mobile phones and related accessories",
        "category": {
          "id": 1,
          "name": "Electronics",
          "description": "Electronic devices and components"
        },
        "created_at": "2024-03-08T09:15:00.000000Z",
        "updated_at": "2024-03-08T09:15:00.000000Z"
      }
    ]
  }
}
This endpoint retrieves all subcategories from the database with their related category information.

Authentication

This endpoint does not require authentication.

Response

success
boolean
Indicates if the request was successful
message
string
A success message confirming the retrieval
data
object
curl --location --request GET 'https://api.yourapp.com/subcategories' \
--header 'Accept: application/json'
{
  "success": true,
  "message": "All subcategories retrieved successfully",
  "data": {
    "subcategories": [
      {
        "id": 2,
        "name": "Laptops",
        "description": "Laptop computers and accessories",
        "category": {
          "id": 1,
          "name": "Electronics",
          "description": "Electronic devices and components"
        },
        "created_at": "2024-03-08T10:30:00.000000Z",
        "updated_at": "2024-03-08T10:30:00.000000Z"
      },
      {
        "id": 1,
        "name": "Smartphones",
        "description": "Mobile phones and related accessories",
        "category": {
          "id": 1,
          "name": "Electronics",
          "description": "Electronic devices and components"
        },
        "created_at": "2024-03-08T09:15:00.000000Z",
        "updated_at": "2024-03-08T09:15:00.000000Z"
      }
    ]
  }
}

Build docs developers (and LLMs) love