Appearance
User - NAS
Base URL:
https://your-domain.com
Admin endpoints for managing NAS (Network Access Server) devices. All endpoints require admin/staff authentication.
Fetch All NAS
Retrieve all NAS devices configured in the system.
| Property | Value |
|---|---|
| Endpoint | Fetch All NAS |
| Method | GET |
| URL | /api/v1/nas |
| 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": "Main NAS",
"ip": "192.168.1.1",
"type": "mikrotik",
"status": "online",
"subscriber_count": 150,
"created_at": "2024-01-01 00:00:00"
}
]
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Unauthenticated"
}Fetch NAS
Retrieve details of a specific NAS device.
| Property | Value |
|---|---|
| Endpoint | Fetch NAS |
| Method | GET |
| URL | /api/v1/nas/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | NAS ID |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "Main NAS",
"ip": "192.168.1.1",
"port": 3799,
"secret": "***hidden***",
"type": "mikrotik",
"status": "online",
"subscriber_count": 150
}
}Error Response (404 Not Found):
json
{
"success": false,
"message": "NAS not found"
}Create NAS
Create a new NAS device.
| Property | Value |
|---|---|
| Endpoint | Create NAS |
| Method | POST |
| URL | /api/v1/nas |
| 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": "Main NAS",
"ip": "192.168.1.1",
"port": 3799,
"secret": "radius-secret",
"type": "mikrotik"
}| 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 | NAS name |
ip | string | Yes | NAS IP address |
port | integer | No | RADIUS port (default: 3799) |
secret | string | Yes | RADIUS shared secret |
type | string | Yes | NAS type (mikrotik, cisco, etc.) |
Success Response (201 Created):
json
{
"success": true,
"message": "NAS created successfully",
"data": {
"id": 1
}
}Error Response (422 Validation Error):
json
{
"success": false,
"message": "Validation failed",
"errors": {
"ip": ["The ip has already been taken."]
}
}Update NAS
Update an existing NAS device.
| Property | Value |
|---|---|
| Endpoint | Update NAS |
| Method | PUT |
| URL | /api/v1/nas/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | NAS ID |
Request Body:
json
{
"name": "Updated NAS",
"secret": "new-radius-secret"
}Success Response (200 OK):
json
{
"success": true,
"message": "NAS updated successfully"
}Error Response (404 Not Found):
json
{
"success": false,
"message": "NAS not found"
}Delete NAS
Delete a NAS device from the system.
| Property | Value |
|---|---|
| Endpoint | Delete NAS |
| Method | DELETE |
| URL | /api/v1/nas/{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": "NAS deleted successfully"
}Error Response (400 Bad Request):
json
{
"success": false,
"message": "Cannot delete NAS with active subscribers"
}Test NAS Connection
Test connectivity to a NAS device.
| Property | Value |
|---|---|
| Endpoint | Test NAS Connection |
| Method | POST |
| URL | /api/v1/nas/{id}/test |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | NAS ID |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1
}Success Response (200 OK):
json
{
"success": true,
"message": "Connection successful",
"data": {
"latency_ms": 15,
"status": "online"
}
}Error Response (500 Server Error):
json
{
"success": false,
"message": "Connection failed: Connection refused"
}