Skip to content

User - Branches

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

Admin endpoints for managing ISP branches. All endpoints require admin authentication.


Fetch All Branches

Retrieve all branches for the ISP.

PropertyValue
EndpointFetch All Branches
MethodGET
URL/api/v1/branches
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Success Response (200 OK):

json
{
    "success": true,
    "data": [
        {
            "id": 1,
            "name": "Main Branch",
            "address": "123 Main Street",
            "subscriber_count": 250,
            "user_count": 10
        }
    ]
}

Fetch Branch

Retrieve details of a specific branch.

PropertyValue
EndpointFetch Branch
MethodGET
URL/api/v1/branches/{id}
AuthenticationBearer Token

Success Response (200 OK):

json
{
    "success": true,
    "data": {
        "id": 1,
        "name": "Main Branch",
        "address": "123 Main Street",
        "phone": "01712345678",
        "subscriber_count": 250,
        "user_count": 10
    }
}

Create Branch

Create a new branch.

PropertyValue
EndpointCreate Branch
MethodPOST
URL/api/v1/branches
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "user_id": 1,
    "name": "New Branch",
    "address": "456 New Street"
}
ParameterTypeRequiredDescription
namestringYesBranch name
addressstringNoBranch address

Success Response (201 Created):

json
{
    "success": true,
    "message": "Branch created successfully",
    "data": {
        "id": 2
    }
}

Update Branch

Update an existing branch.

PropertyValue
EndpointUpdate Branch
MethodPUT
URL/api/v1/branches/{id}
AuthenticationBearer Token

Request Body:

json
{
    "name": "Updated Branch"
}

Success Response (200 OK):

json
{
    "success": true,
    "message": "Branch updated successfully"
}

Delete Branch

Delete a branch from the system.

PropertyValue
EndpointDelete Branch
MethodDELETE
URL/api/v1/branches/{id}
AuthenticationBearer Token

Success Response (200 OK):

json
{
    "success": true,
    "message": "Branch deleted successfully"
}

Error Response (400 Bad Request):

json
{
    "success": false,
    "message": "Cannot delete branch with active subscribers"
}

www.onezeroart.com