Appearance
User - Bandwidth Allocations
Base URL:
https://your-domain.com
Admin endpoints for managing bandwidth allocations/profiles. All endpoints require admin/staff authentication.
Fetch All Bandwidth Allocations
Retrieve all bandwidth profiles configured in the system.
| Property | Value |
|---|---|
| Endpoint | Fetch All Bandwidth Allocations |
| Method | GET |
| URL | /api/v1/bandwidth-allocations |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M",
"package_count": 5
}
]
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/bandwidth-allocations" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('GET', '/api/v1/bandwidth-allocations', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const response = await fetch(`${BASE_URL}/api/v1/bandwidth-allocations`, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
response = requests.get(
f"{BASE_URL}/api/v1/bandwidth-allocations",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/bandwidth-allocations"
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let response = client
.get(format!("{BASE_URL}/api/v1/bandwidth-allocations"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch Bandwidth Allocation
Retrieve details of a specific bandwidth profile.
| Property | Value |
|---|---|
| Endpoint | Fetch Bandwidth Allocation |
| Method | GET |
| URL | /api/v1/bandwidth-allocations/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M"
}
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/bandwidth-allocations/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$bandwidthAllocationId = 1;
$response = $client->request('GET', "/api/v1/bandwidth-allocations/{$bandwidthAllocationId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const bandwidthAllocationId = 1;
const response = await fetch(`${BASE_URL}/api/v1/bandwidth-allocations/${bandwidthAllocationId}`, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
bandwidth_allocation_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/bandwidth-allocations/{bandwidth_allocation_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
bandwidthAllocationId := 1
endpoint := baseURL + "/api/v1/bandwidth-allocations/" + strconv.Itoa(bandwidthAllocationId)
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let bandwidth_allocation_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/bandwidth-allocations/{bandwidth_allocation_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Create Bandwidth Allocation
Create a new bandwidth profile.
| Property | Value |
|---|---|
| Endpoint | Create Bandwidth Allocation |
| Method | POST |
| URL | /api/v1/bandwidth-allocations |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M"
}| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Profile name |
upload | integer | Yes | Upload speed value |
download | integer | Yes | Download speed value |
upload_unit | string | Yes | Upload unit (K, M, G) |
download_unit | string | Yes | Download unit (K, M, G) |
Success Response (201 Created):
json
{
"success": true,
"message": "Bandwidth allocation created successfully",
"data": {
"id": 1
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/bandwidth-allocations" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M"
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('POST', '/api/v1/bandwidth-allocations', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'name' => '50Mbps',
'upload' => 50,
'download' => 50,
'upload_unit' => 'M',
'download_unit' => 'M',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const response = await fetch(`${BASE_URL}/api/v1/bandwidth-allocations`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
name: '50Mbps',
upload: 50,
download: 50,
upload_unit: 'M',
download_unit: 'M',
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
response = requests.post(
f"{BASE_URL}/api/v1/bandwidth-allocations",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M",
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/bandwidth-allocations"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M",
})
req, _ := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let response = client
.post(format!("{BASE_URL}/api/v1/bandwidth-allocations"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "50Mbps",
"upload": 50,
"download": 50,
"upload_unit": "M",
"download_unit": "M"
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Update Bandwidth Allocation
Update an existing bandwidth profile.
| Property | Value |
|---|---|
| Endpoint | Update Bandwidth Allocation |
| Method | PUT |
| URL | /api/v1/bandwidth-allocations/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"name": "100Mbps",
"upload": 100,
"download": 100
}Success Response (200 OK):
json
{
"success": true,
"message": "Bandwidth allocation updated successfully"
}Code Examples:
bash
curl -X PUT "https://your-domain.com/api/v1/bandwidth-allocations/1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"name": "100Mbps",
"upload": 100,
"download": 100
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$bandwidthAllocationId = 1;
$response = $client->request('PUT', "/api/v1/bandwidth-allocations/{$bandwidthAllocationId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'name' => '100Mbps',
'upload' => 100,
'download' => 100,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const bandwidthAllocationId = 1;
const response = await fetch(`${BASE_URL}/api/v1/bandwidth-allocations/${bandwidthAllocationId}`, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
name: '100Mbps',
upload: 100,
download: 100,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
bandwidth_allocation_id = 1
response = requests.put(
f"{BASE_URL}/api/v1/bandwidth-allocations/{bandwidth_allocation_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"name": "100Mbps",
"upload": 100,
"download": 100,
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
bandwidthAllocationId := 1
endpoint := baseURL + "/api/v1/bandwidth-allocations/" + strconv.Itoa(bandwidthAllocationId)
payload, _ := json.Marshal(map[string]any{
"name": "100Mbps",
"upload": 100,
"download": 100,
})
req, _ := http.NewRequest("PUT", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let bandwidth_allocation_id = 1;
let response = client
.put(format!("{BASE_URL}/api/v1/bandwidth-allocations/{bandwidth_allocation_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"name": "100Mbps",
"upload": 100,
"download": 100
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Delete Bandwidth Allocation
Delete a bandwidth profile.
| Property | Value |
|---|---|
| Endpoint | Delete Bandwidth Allocation |
| Method | DELETE |
| URL | /api/v1/bandwidth-allocations/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "Bandwidth allocation deleted successfully"
}Code Examples:
bash
curl -X DELETE "https://your-domain.com/api/v1/bandwidth-allocations/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$bandwidthAllocationId = 1;
$response = $client->request('DELETE', "/api/v1/bandwidth-allocations/{$bandwidthAllocationId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const bandwidthAllocationId = 1;
const response = await fetch(`${BASE_URL}/api/v1/bandwidth-allocations/${bandwidthAllocationId}`, {
method: 'DELETE',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
bandwidth_allocation_id = 1
response = requests.delete(
f"{BASE_URL}/api/v1/bandwidth-allocations/{bandwidth_allocation_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
bandwidthAllocationId := 1
endpoint := baseURL + "/api/v1/bandwidth-allocations/" + strconv.Itoa(bandwidthAllocationId)
req, _ := http.NewRequest("DELETE", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let bandwidth_allocation_id = 1;
let response = client
.delete(format!("{BASE_URL}/api/v1/bandwidth-allocations/{bandwidth_allocation_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}