Skip to content

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.

PropertyValue
EndpointFetch All Areas
MethodGET
URL/api/v1/areas
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

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.

PropertyValue
EndpointFetch Area Hierarchy
MethodGET
URL/api/v1/areas/hierarchy
AuthenticationBearer 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.

PropertyValue
EndpointFetch Area
MethodGET
URL/api/v1/areas/{id}
AuthenticationBearer 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.

PropertyValue
EndpointCreate Area
MethodPOST
URL/api/v1/areas
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1,
    "name": "New Area",
    "type": "area",
    "parent_id": 1
}
ParameterTypeRequiredDescription
namestringYesArea name
typestringYesType (zone, area, subarea)
parent_idintegerNoParent area ID

Success Response (201 Created):

json
{
    "success": true,
    "message": "Area created successfully",
    "data": {
        "id": 3
    }
}

Update Area

Update an existing area.

PropertyValue
EndpointUpdate Area
MethodPUT
URL/api/v1/areas/{id}
AuthenticationBearer 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.

PropertyValue
EndpointDelete Area
MethodDELETE
URL/api/v1/areas/{id}
AuthenticationBearer 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"
}

www.onezeroart.com