Skip to content

Areas ​

Base URL: https://your-domain.com/api/v1

Cities, areas and sub-areas. Each has a code that subscribers reference. Hierarchy: an area belongs to a city (by the city's code); a sub-area belongs to an area (by the area's code). Requires HTTP Basic Auth.

List ​

GET /api/v1/area/list — Filters: type (city|area|subarea), parent_code, limit, offset.

  • 200: [ { "id": 7, "type": "city", "code": 1, "parent_code": null, "name": "Dhaka" } ]

Get ​

GET /api/v1/area/get/{id} — Single row. 404 if not found.

Create ​

POST /api/v1/area/create

  • Params: type (required) (city|area|subarea), name (required), parent_code (required) for area/subarea (the parent's code).
  • The next per-type code is assigned automatically.
  • 200: { "success": "Area Successfully Created.", "id": 42, "code": 5 }

Update ​

POST /api/v1/area/update — Rename. Params: id (required), name (required).

Delete ​

DELETE /api/v1/area/delete/{id} — Blocked if subscribers are assigned to it (400).

Hierarchy ​

GET /api/v1/area/hierarchy — Nested cities → areas → subareas.

  • 200:
json
[ { "id": 7, "code": 1, "name": "Dhaka",
    "areas": [ { "code": 2, "name": "Gulshan", "subareas": [ { "code": 3, "name": "Gulshan-1" } ] } ] } ]

www.onezeroart.com