Skip to content

User - Inventory

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

Admin endpoints for managing inventory items. All endpoints require admin/staff authentication.


Fetch All Inventory

Retrieve all inventory items.

PropertyValue
EndpointFetch All Inventory
MethodGET
URL/api/v1/inventory
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Success Response (200 OK):

json
{
    "success": true,
    "data": [
        {
            "id": 1,
            "name": "Router",
            "type": "equipment",
            "quantity": 10,
            "assigned": 5,
            "available": 5
        }
    ]
}

Fetch Inventory Item

Retrieve details of a specific inventory item.

PropertyValue
EndpointFetch Inventory Item
MethodGET
URL/api/v1/inventory/{id}
AuthenticationBearer Token

Success Response (200 OK):

json
{
    "success": true,
    "data": {
        "id": 1,
        "name": "Router",
        "type": "equipment",
        "quantity": 10,
        "assigned": 5,
        "available": 5,
        "unit_price": 2500
    }
}

Create Inventory Item

Add a new inventory item.

PropertyValue
EndpointCreate Inventory Item
MethodPOST
URL/api/v1/inventory
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1,
    "name": "Router",
    "type": "equipment",
    "quantity": 10
}
ParameterTypeRequiredDescription
namestringYesItem name
typestringYesItem type
quantityintegerYesInitial quantity

Success Response (201 Created):

json
{
    "success": true,
    "message": "Inventory item created successfully",
    "data": {
        "id": 1
    }
}

Update Inventory Item

Update an existing inventory item.

PropertyValue
EndpointUpdate Inventory Item
MethodPUT
URL/api/v1/inventory/{id}
AuthenticationBearer Token

Request Body:

json
{
    "quantity": 15
}

Success Response (200 OK):

json
{
    "success": true,
    "message": "Inventory item updated successfully"
}

Delete Inventory Item

Delete an inventory item.

PropertyValue
EndpointDelete Inventory Item
MethodDELETE
URL/api/v1/inventory/{id}
AuthenticationBearer Token

Success Response (200 OK):

json
{
    "success": true,
    "message": "Inventory item deleted successfully"
}

Assign Inventory

Assign an inventory item to a subscriber.

PropertyValue
EndpointAssign Inventory
MethodPOST
URL/api/v1/inventory/{id}/assign
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1,
    "subscriber_id": 1
}

Success Response (200 OK):

json
{
    "success": true,
    "message": "Inventory assigned successfully"
}

Unassign Inventory

Remove inventory assignment from a subscriber.

PropertyValue
EndpointUnassign Inventory
MethodPOST
URL/api/v1/inventory/{id}/unassign
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1
}

Success Response (200 OK):

json
{
    "success": true,
    "message": "Inventory unassigned successfully"
}

www.onezeroart.com