Appearance
User - Packages
Base URL:
https://your-domain.com
Admin endpoints for managing internet packages. All endpoints require admin/staff authentication.
Fetch All Packages
Retrieve all packages available in the system.
| Property | Value |
|---|---|
| Endpoint | Fetch All Packages |
| Method | GET |
| URL | /api/v1/packages |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "10MB Package",
"price": 1000,
"validity_days": 30,
"bandwidth_up": "10M",
"bandwidth_down": "10M",
"data_limit": null,
"status": "active",
"subscriber_count": 45
}
]
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Unauthenticated"
}Fetch Package
Retrieve details of a specific package.
| Property | Value |
|---|---|
| Endpoint | Fetch Package |
| Method | GET |
| URL | /api/v1/packages/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Package ID |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "10MB Package",
"price": 1000,
"validity_days": 30,
"bandwidth_up": "10M",
"bandwidth_down": "10M",
"data_limit": null,
"burst_limit": "12M/12M",
"priority": 8,
"status": "active"
}
}Error Response (404 Not Found):
json
{
"success": false,
"message": "Package not found"
}Create Package
Create a new internet package.
| Property | Value |
|---|---|
| Endpoint | Create Package |
| Method | POST |
| URL | /api/v1/packages |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "10MB Package",
"price": 1000,
"validity_days": 30,
"bandwidth_up": "10M",
"bandwidth_down": "10M"
}| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
name | string | Yes | Package name |
price | decimal | Yes | Package price |
validity_days | integer | No | Validity in days |
bandwidth_up | string | No | Upload bandwidth (e.g., "10M") |
bandwidth_down | string | No | Download bandwidth (e.g., "10M") |
Success Response (201 Created):
json
{
"success": true,
"message": "Package created successfully",
"data": {
"id": 1
}
}Error Response (422 Validation Error):
json
{
"success": false,
"message": "Validation failed",
"errors": {
"name": ["The name field is required."]
}
}Update Package
Update an existing package.
| Property | Value |
|---|---|
| Endpoint | Update Package |
| Method | PUT |
| URL | /api/v1/packages/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Package ID |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "10MB Package Updated",
"price": 1200
}Success Response (200 OK):
json
{
"success": true,
"message": "Package updated successfully"
}Error Response (404 Not Found):
json
{
"success": false,
"message": "Package not found"
}Delete Package
Delete a package from the system.
| Property | Value |
|---|---|
| Endpoint | Delete Package |
| Method | DELETE |
| URL | /api/v1/packages/{id} |
| Authentication | Bearer Token |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
Success Response (200 OK):
json
{
"success": true,
"message": "Package deleted successfully"
}Error Response (400 Bad Request):
json
{
"success": false,
"message": "Cannot delete package with active subscribers"
}Get My Packages
Get packages assigned to the current salesperson/reseller.
| Property | Value |
|---|---|
| Endpoint | Get My Packages |
| Method | GET |
| URL | /api/v1/packages/my-packages |
| Authentication | Bearer Token |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
salesperson_id | integer | Yes | Salesperson ID |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "10MB Package",
"price": 800,
"profit": 100,
"original_price": 1000
}
]
}Assign Package
Assign a package to a reseller with custom pricing.
| Property | Value |
|---|---|
| Endpoint | Assign Package |
| Method | POST |
| URL | /api/v1/packages/{id}/assign |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Package ID |
Request Body:
json
{
"reseller_id": 2,
"price": 800,
"profit": 100
}| Parameter | Type | Required | Description |
|---|---|---|---|
reseller_id | integer | Yes | Reseller user ID |
price | decimal | Yes | Reseller's selling price |
profit | decimal | No | Profit margin |
Success Response (201 Created):
json
{
"success": true,
"message": "Package assigned successfully"
}Get Package Assignments
Get all reseller assignments for a package.
| Property | Value |
|---|---|
| Endpoint | Get Package Assignments |
| Method | GET |
| URL | /api/v1/packages/{id}/assignments |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"assignment_id": 1,
"reseller_id": 2,
"reseller_name": "Reseller One",
"price": 800,
"profit": 100
}
]
}Update Assignment
Update a package assignment for a reseller.
| Property | Value |
|---|---|
| Endpoint | Update Assignment |
| Method | PUT |
| URL | /api/v1/packages/{id}/assignments/{assignment_id} |
| Authentication | Bearer Token |
Request Body:
json
{
"price": 850,
"profit": 150
}Success Response (200 OK):
json
{
"success": true,
"message": "Assignment updated successfully"
}Remove Assignment
Remove a package assignment from a reseller.
| Property | Value |
|---|---|
| Endpoint | Remove Assignment |
| Method | DELETE |
| URL | /api/v1/packages/{id}/assignments/{assignment_id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "Assignment removed successfully"
}