Appearance
User - Areas
Base URL:
https://your-domain.com
Admin endpoints for managing geographical areas/zones. All endpoints require admin/staff authentication.
Fetch All Areas
Retrieve all areas configured in the system.
| Property | Value |
|---|---|
| Endpoint | Fetch All Areas |
| Method | GET |
| URL | /api/v1/areas |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "Zone A",
"type": "zone",
"parent_id": null,
"subscriber_count": 150
}
]
}Fetch Area Hierarchy
Get areas in a hierarchical tree structure.
| Property | Value |
|---|---|
| Endpoint | Fetch Area Hierarchy |
| Method | GET |
| URL | /api/v1/areas/hierarchy |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "Zone A",
"type": "zone",
"children": [
{
"id": 2,
"name": "Area 1",
"type": "area",
"children": []
}
]
}
]
}Fetch Area
Retrieve details of a specific area.
| Property | Value |
|---|---|
| Endpoint | Fetch Area |
| Method | GET |
| URL | /api/v1/areas/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "Zone A",
"type": "zone",
"parent_id": null,
"subscriber_count": 150
}
}Create Area
Create a new area or zone.
| Property | Value |
|---|---|
| Endpoint | Create Area |
| Method | POST |
| URL | /api/v1/areas |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "New Area",
"type": "area",
"parent_id": 1
}| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Area name |
type | string | Yes | Type (zone, area, subarea) |
parent_id | integer | No | Parent area ID |
Success Response (201 Created):
json
{
"success": true,
"message": "Area created successfully",
"data": {
"id": 3
}
}Update Area
Update an existing area.
| Property | Value |
|---|---|
| Endpoint | Update Area |
| Method | PUT |
| URL | /api/v1/areas/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"name": "Updated Area"
}Success Response (200 OK):
json
{
"success": true,
"message": "Area updated successfully"
}Delete Area
Delete an area from the system.
| Property | Value |
|---|---|
| Endpoint | Delete Area |
| Method | DELETE |
| URL | /api/v1/areas/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "Area deleted successfully"
}Error Response (400 Bad Request):
json
{
"success": false,
"message": "Cannot delete area with subscribers"
}