wOow Global

List Categories

Get all product categories

List Categories

This endpoint allows users to retrieve a list of resources. It is a simple HTTP GET request that does not require any parameters to be passed in the request body.

API Tester - List Categories

Retrieve all product categories

Environment:
GET
https://dev-api.woowbd.com/api/v1/developer/categories

Get your token from: http://dev-app.woowbd.com/dashboard/developer

Endpoint

GET /categories

Request Parameters

None: This endpoint does not require any query parameters or request body.

Expected Response

The response will be in JSON format and contains the following fields:

  • status (boolean): Indicates the success of the request.
  • message (string): A message providing additional context about the request. This may be empty.
  • data (array): An array of resource objects. Each object contains:
    • id (integer): The unique identifier for the resource.
    • name (string): The name of the resource.
    • created_at (string): The timestamp when the resource was created.
    • updated_at (string): The timestamp when the resource was last updated.
  • errors (array): An array that will contain any errors encountered during the request. This will be empty if there are no errors.
  • response_code (string): A code representing the response status.

Example Request

curl -X GET "https://api.woowbd.com/categories" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "status": true,
  "message": "Categories retrieved successfully",
  "data": [
    {
      "id": 1,
      "name": "Electronics",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": 2,
      "name": "Clothing",
      "created_at": "2024-01-15T11:00:00Z",
      "updated_at": "2024-01-15T11:00:00Z"
    },
    {
      "id": 3,
      "name": "Books",
      "created_at": "2024-01-15T11:30:00Z",
      "updated_at": "2024-01-15T11:30:00Z"
    }
  ],
  "errors": [],
  "response_code": "200"
}

Notes

  • Ensure that the request is made to the correct endpoint to receive the expected response.
  • The data array will be empty if there are no resources available.

Code Examples

JavaScript

const response = await fetch('https://api.woowbd.com/categories', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  }
});

const data = await response.json();
console.log(data.data); // Array of categories

Python

import requests

response = requests.get(
    'https://api.woowbd.com/categories',
    headers={
        'Authorization': f'Bearer {API_KEY}',
        'Content-Type': 'application/json'
    }
)

data = response.json()
categories = data['data']  // Array of categories

PHP

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.woowbd.com/categories');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $API_KEY,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
$categories = $data['data'];  // Array of categories