Zones - Usage Examples

Last Updated: 2026-02-27

Authentication

# Step 1: Obtain token
curl -s -X POST https://api.djanity.com/auth/login/ \
  -H "Content-Type: application/json" \
  -d '{"username": "[email protected]", "password": "..."}'
# Returns: {"access": "<jwt>", "refresh": "<jwt>"}

# Step 2: All subsequent requests use:
# -H "Authorization: Bearer <token>"

Zones

List all zones

Supports filtering by zone_name, store_name, is_shown, and store_location.

curl -s "https://api.djanity.com/zones/?store_name=London" \
  -H "Authorization: Bearer <token>"

Response:

[
  {
    "id": "zone-uuid-001",
    "sanity_id": "zone-coffee-bar-lon001",
    "zone_name": "Coffee Bar",
    "store_location": "store-uuid-001",
    "zone_type": {
      "type": "inventory",
      "data": {"countFrequency": "weekly"}
    },
    "is_shown": true,
    "display_order": 1,
    "created_at": "2026-01-15T10:00:00Z"
  }
]

Retrieve a zone

curl -s https://api.djanity.com/zones/zone-uuid-001/ \
  -H "Authorization: Bearer <token>"

Get zones by store

curl -s "https://api.djanity.com/zones/by_store/?store_id=store-uuid-001" \
  -H "Authorization: Bearer <token>"

Response:

[
  {
    "id": "zone-uuid-001",
    "zone_name": "Coffee Bar",
    "zone_type": {"type": "inventory"},
    "display_order": 1
  },
  {
    "id": "zone-uuid-002",
    "zone_name": "Bakery Display",
    "zone_type": {"type": "merchandising"},
    "display_order": 2
  }
]

Get products assigned to a zone

curl -s https://api.djanity.com/zones/zone-uuid-001/products/ \
  -H "Authorization: Bearer <token>"

Response:

[
  {
    "product_id": "product-uuid-001",
    "product_name": "Dark Roast Coffee",
    "variant_sku": "DARK-12OZ",
    "variant_name": "12oz Bag",
    "par_quantity": 10,
    "par_level_id": "par-uuid-001"
  },
  {
    "product_id": "product-uuid-002",
    "product_name": "Light Roast Coffee",
    "variant_sku": "LIGHT-12OZ",
    "variant_name": "12oz Bag",
    "par_quantity": 8,
    "par_level_id": "par-uuid-002"
  }
]

Sync inventory infrastructure for a zone

Creates InventoryLevel records for all par level items in the zone.

curl -s -X POST https://api.djanity.com/zones/zone-uuid-001/sync_inventory/ \
  -H "Authorization: Bearer <token>"

Response:

{
  "message": "Inventory sync completed for zone Coffee Bar",
  "stats": {
    "created": 8,
    "existing": 2,
    "failed": 0,
    "errors": []
  }
}

Create a zone

curl -s -X POST https://api.djanity.com/zones/ \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "sanity_id": "zone-bakery-lon001",
    "zone_name": "Bakery Display",
    "store_location": "store-uuid-001",
    "zone_type": {
      "type": "merchandising",
      "data": {
        "display_standards": ["Eye level placement", "FIFO rotation", "Price tags visible"]
      }
    },
    "is_shown": true,
    "display_order": 3
  }'

Par Level Items

List par levels

Supports filtering by zone_inventory, product, and store_location.

curl -s "https://api.djanity.com/zones/par-levels/?zone_inventory=zone-inv-uuid-001" \
  -H "Authorization: Bearer <token>"

Response:

[
  {
    "id": "par-uuid-001",
    "sanity_id": "par-dark-coffee-lon001",
    "product": "product-uuid-001",
    "product_name": "Dark Roast Coffee",
    "variant_sku": "DARK-12OZ",
    "quantity": 10,
    "variant_exists": true,
    "inventory_level_exists": true,
    "created_at": "2026-01-15T10:00:00Z"
  }
]

Get par levels for a specific product variant

curl -s "https://api.djanity.com/zones/par-levels/by_product/?product_id=product-uuid-001&variant_sku=DARK-12OZ" \
  -H "Authorization: Bearer <token>"

Response:

[
  {
    "id": "par-uuid-001",
    "zone_inventory": "zone-inv-uuid-001",
    "product_name": "Dark Roast Coffee",
    "variant_sku": "DARK-12OZ",
    "quantity": 10,
    "variant_exists": true,
    "inventory_level_exists": true
  },
  {
    "id": "par-uuid-005",
    "zone_inventory": "zone-inv-uuid-002",
    "product_name": "Dark Roast Coffee",
    "variant_sku": "DARK-12OZ",
    "quantity": 6,
    "variant_exists": true,
    "inventory_level_exists": true
  }
]

Create a par level item

curl -s -X POST https://api.djanity.com/zones/par-levels/ \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "zone_inventory": "zone-inv-uuid-001",
    "product": "product-uuid-001",
    "variant_sku": "DARK-12OZ",
    "quantity": 12,
    "sanity_id": "par-dark-12oz-v2"
  }'

Ensure an inventory level exists for a par level item

curl -s -X POST https://api.djanity.com/zones/par-levels/par-uuid-001/ensure_inventory_level/ \
  -H "Authorization: Bearer <token>"

Response (newly created):

{
  "message": "InventoryLevel ensured",
  "inventory_level_id": "inv-level-uuid-001",
  "created": true
}

Response (already existed):

{
  "message": "InventoryLevel ensured",
  "inventory_level_id": "inv-level-uuid-001",
  "created": false
}

Zone Inventory — SKU Validation

Validate all SKUs in a zone inventory

curl -s -X POST https://api.djanity.com/zones/inventory/zone-inv-uuid-001/validate_skus/ \
  -H "Authorization: Bearer <token>"

Response (all valid):

{
  "valid_count": 12,
  "invalid_count": 0,
  "invalid_items": [],
  "total_count": 12
}

Response (mismatches found):

{
  "valid_count": 10,
  "invalid_count": 2,
  "invalid_items": [
    {
      "par_level_id": "par-uuid-999",
      "product_name": "Dark Roast Coffee",
      "variant_sku": "DARK-12OZ-OLD",
      "error": "No ProductVariant found with SKU 'DARK-12OZ-OLD' for product 'Dark Roast Coffee'"
    }
  ],
  "total_count": 12
}

Planograms

List planograms

curl -s https://api.djanity.com/planograms/ \
  -H "Authorization: Bearer <token>"

Response:

[
  {
    "id": "planogram-uuid-001",
    "sanity_id": "planogram-holiday-coffee-v2",
    "planogram_name": "Holiday Coffee Display",
    "version": "v2.0",
    "effective_date": "2026-12-01",
    "campaign": "campaign-uuid-001",
    "created_at": "2026-10-01T10:00:00Z"
  }
]

Get target assignments for a planogram

curl -s https://api.djanity.com/planograms/planogram-uuid-001/target_assignments/ \
  -H "Authorization: Bearer <token>"

Response:

{
  "target_stores": [
    {"id": "store-uuid-001", "name": "London Flagship", "store_code": "LON001"},
    {"id": "store-uuid-002", "name": "Manchester Central", "store_code": "MAN001"}
  ],
  "target_zones": [
    {
      "id": "zone-uuid-001",
      "zone_name": "Coffee Bar",
      "store_location__name": "London Flagship",
      "zone_type": {"type": "merchandising"}
    }
  ]
}

Was this page helpful?