Docs
Introduction

Documentation

Learn how to integrate ConnectX into your application.

Categories API Overview

Learn how to manage product categories in ConnectX

The Categories API allows you to manage product categories in ConnectX. Categories help organize products and make them easier to find. Each tenant can create and manage their own categories.

All API requests require authentication using an API key. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

All API endpoints are relative to the base URL:

https://connectx-backend-4o0i.onrender.com/api

Categories

  • GET /categories/ - List categories
  • GET /categories/{id}/ - Get category details
  • POST /categories/ - Create a new category
  • PATCH /categories/{id}/ - Update a category
  • DELETE /categories/{id}/ - Delete a category

Category Permissions

  • All authenticated users can view categories
  • Only tenant owners can create, update, and delete categories
  • Users can only access categories within their own tenant

Category Requirements

  • Category name is required and must be unique within a tenant
  • Description is optional but recommended
  • Categories are automatically associated with the tenant of the creating user

Get a list of categories for the current tenant.

Command

curl -X GET 'https://connectx-backend-4o0i.onrender.com/api/categories/' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json'

Response

[
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Electronics",
    "description": "Electronic devices and accessories",
    "tenant": "123e4567-e89b-12d3-a456-426614174001",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  },
  {
    "id": "123e4567-e89b-12d3-a456-426614174002",
    "name": "Clothing",
    "description": "Apparel and fashion items",
    "tenant": "123e4567-e89b-12d3-a456-426614174001",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
]

Get details of a specific category.

Command

curl -X GET 'https://connectx-backend-4o0i.onrender.com/api/categories/123e4567-e89b-12d3-a456-426614174000/' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json'

Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Electronics",
  "description": "Electronic devices and accessories",
  "tenant": "123e4567-e89b-12d3-a456-426614174001",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}

Create a new category. Only tenant owners can create categories.

Command

curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/categories/' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Home & Kitchen",
    "description": "Home appliances and kitchen items"
  }'

Response

{
  "id": "123e4567-e89b-12d3-a456-426614174003",
  "name": "Home & Kitchen",
  "description": "Home appliances and kitchen items",
  "tenant": "123e4567-e89b-12d3-a456-426614174001",
  "created_at": "2024-01-03T00:00:00Z",
  "updated_at": "2024-01-03T00:00:00Z"
}

Update an existing category. Only tenant owners can update categories.

Command

curl -X PATCH 'https://connectx-backend-4o0i.onrender.com/api/categories/123e4567-e89b-12d3-a456-426614174000/' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Electronics & Gadgets",
    "description": "Updated description for electronics category"
  }'

Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Electronics & Gadgets",
  "description": "Updated description for electronics category",
  "tenant": "123e4567-e89b-12d3-a456-426614174001",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-04T00:00:00Z"
}

Delete a category. Only tenant owners can delete categories.

Command

curl -X DELETE 'https://connectx-backend-4o0i.onrender.com/api/categories/123e4567-e89b-12d3-a456-426614174000/' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'

Response

{
  "message": "Category deleted successfully"
}