Docs
Introduction

Documentation

Learn how to integrate ConnectX into your application.

Orders API Overview

Learn how to interact with the ConnectX Orders API

The Orders API allows you to manage orders in your ConnectX store. You can create and list orders using simple HTTP requests.

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

Orders

  • GET /orders/ - List all orders
  • POST /orders/ - Create a new order

Get a list of all orders

Command

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

Response

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "order_number": "ORD-2024-001",
      "user": "123e4567-e89b-12d3-a456-426614174001",
      "tenant": "123e4567-e89b-12d3-a456-426614174002",
      "status": "pending",
      "total_amount": 1999.98,
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174003",
          "product": "123e4567-e89b-12d3-a456-426614174004",
          "quantity": 2,
          "price": 999.99
        }
      ],
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    },
    {
      "id": "123e4567-e89b-12d3-a456-426614174005",
      "order_number": "ORD-2024-002",
      "user": "123e4567-e89b-12d3-a456-426614174001",
      "tenant": "123e4567-e89b-12d3-a456-426614174002",
      "status": "processing",
      "total_amount": 1499.99,
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174006",
          "product": "123e4567-e89b-12d3-a456-426614174007",
          "quantity": 1,
          "price": 1499.99
        }
      ],
      "created_at": "2024-01-02T00:00:00Z",
      "updated_at": "2024-01-02T00:00:00Z"
    }
  ]
}

Create a new order

Command

curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/orders/' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "items": [
      {
        "product_id": "123e4567-e89b-12d3-a456-426614174004",
        "quantity": 2
      }
    ]
  }'

Response

{
  "id": "123e4567-e89b-12d3-a456-426614174008",
  "order_number": "ORD-2024-003",
  "user": "123e4567-e89b-12d3-a456-426614174001",
  "tenant": "123e4567-e89b-12d3-a456-426614174002",
  "status": "pending",
  "total_amount": 1999.98,
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174009",
      "product": "123e4567-e89b-12d3-a456-426614174004",
      "quantity": 2,
      "price": 999.99
    }
  ],
  "created_at": "2024-01-03T00:00:00Z",
  "updated_at": "2024-01-03T00:00:00Z"
}