Quickstart

This guide will get you started with the Djanity API. We'll cover authentication, making your first API request, and navigating the comprehensive documentation to build powerful e-commerce applications.

Understanding the API Structure

The Djanity API is organized into logical domains that mirror real-world e-commerce operations:

Core Infrastructure

  • Core - Foundation models, validators, and utilities
  • Integrations - Sanity CMS sync and webhook processing

Business Domains

  • Users - User management and authentication
  • Products - Product catalog and inventory
  • Stores - Multi-location store management
  • Zones - Zone-based inventory allocation
  • Transactions - POS sales and returns
  • Payments - Payment processing and refunds
  • Promotions - Marketing campaigns and discounts

Advanced Operations

  • POS Gateway - Real-time WebSocket integration
  • Tasks - Task management and scheduling
  • Web Auth - Web authentication and sessions

Authentication

The API supports multiple authentication methods depending on your use case:

import requests

headers = {
    'Authorization': 'Token your-api-token-here',
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://api.example.com/users/',
    headers=headers
)

Making Your First Request

Let's retrieve a list of products from the API:

import requests

headers = {
    'Authorization': 'Token your-api-token-here'
}

# Get all active products
response = requests.get(
    'https://api.example.com/products/',
    headers=headers,
    params={'active': True}
)

products = response.json()

Common API Patterns

Pagination

All list endpoints support pagination:

# Navigate through pages
response = requests.get(
    'https://api.example.com/products/',
    params={'page': 2, 'page_size': 50}
)

Filtering

Most endpoints support field-based filtering:

# Filter products by category
response = requests.get(
    'https://api.example.com/products/',
    params={
        'category': 'electronics',
        'active': True,
        'price__gte': 10.00
    }
)

Creating Resources

Create new resources with POST requests:

# Create a new product
response = requests.post(
    'https://api.example.com/products/',
    headers=headers,
    json={
        'name': 'New Product',
        'sku': 'SKU-NEW-001',
        'price': '49.99',
        'active': True
    }
)

Next Steps

Now that you've made your first request, explore the domain-specific documentation:

Additional Resources


Detailed endpoint documentation, models, serializers, and examples are available in each domain's section.

Was this page helpful?