Appearance
User - OLT/ONU
Base URL:
https://your-domain.com
Admin endpoints for managing OLT devices and ONU information. All endpoints require admin/staff authentication.
Fetch All OLTs
Retrieve all OLT devices configured in the system.
| Property | Value |
|---|---|
| Endpoint | Fetch All OLTs |
| Method | GET |
| URL | /api/v1/olts |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "OLT-Main",
"ip_address": "192.168.1.1",
"type": "huawei",
"status": "online",
"onu_count": 150,
"last_sync": "2024-01-15 10:30:00"
}
]
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Unauthenticated"
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/olts" \
-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/olts', [
'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/olts`, {
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/olts",
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/olts"
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/olts"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Get OLT By Id
Retrieve details of a specific OLT device.
| Property | Value |
|---|---|
| Endpoint | Get OLT By Id |
| Method | GET |
| URL | /api/v1/olts/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | OLT ID |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "OLT-Main",
"ip_address": "192.168.1.1",
"port": 23,
"username": "admin",
"type": "huawei",
"status": "online",
"onu_count": 150,
"created_at": "2024-01-01 00:00:00"
}
}Error Response (404 Not Found):
json
{
"success": false,
"message": "OLT not found"
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/olts/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']);
$oltId = 1;
$response = $client->request('GET', "/api/v1/olts/{$oltId}", [
'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 oltId = 1;
const response = await fetch(`${BASE_URL}/api/v1/olts/${oltId}`, {
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"
olt_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/olts/{olt_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() {
oltId := 1
endpoint := baseURL + "/api/v1/olts/" + strconv.Itoa(oltId)
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 olt_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/olts/{olt_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Test OLT Connection
Test connectivity to an OLT device.
| Property | Value |
|---|---|
| Endpoint | Test OLT Connection |
| Method | POST |
| URL | /api/v1/olts/{id}/test-connection |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | OLT ID |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"message": "Connection successful",
"data": {
"latency_ms": 25,
"status": "online"
}
}Error Response (500 Server Error):
json
{
"success": false,
"message": "Connection failed: Timeout"
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/olts/1/test-connection" \
-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']);
$oltId = 1;
$response = $client->request('POST', "/api/v1/olts/{$oltId}/test-connection", [
'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 oltId = 1;
const response = await fetch(`${BASE_URL}/api/v1/olts/${oltId}/test-connection`, {
method: 'POST',
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"
olt_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/olts/{olt_id}/test-connection",
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() {
oltId := 1
endpoint := baseURL + "/api/v1/olts/" + strconv.Itoa(oltId) + "/test-connection"
req, _ := http.NewRequest("POST", 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 olt_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/olts/{olt_id}/test-connection"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Discover ONUs On OLT
Discover and sync ONUs connected to an OLT.
| Property | Value |
|---|---|
| Endpoint | Discover ONUs |
| Method | POST |
| URL | /api/v1/olts/{id}/discover-onus |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | OLT ID |
Success Response (200 OK):
json
{
"success": true,
"message": "Discovery completed",
"data": {
"total_onus": 150,
"new_onus": 5,
"updated_onus": 145
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/olts/1/discover-onus" \
-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']);
$oltId = 1;
$response = $client->request('POST', "/api/v1/olts/{$oltId}/discover-onus", [
'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 oltId = 1;
const response = await fetch(`${BASE_URL}/api/v1/olts/${oltId}/discover-onus`, {
method: 'POST',
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"
olt_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/olts/{olt_id}/discover-onus",
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() {
oltId := 1
endpoint := baseURL + "/api/v1/olts/" + strconv.Itoa(oltId) + "/discover-onus"
req, _ := http.NewRequest("POST", 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 olt_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/olts/{olt_id}/discover-onus"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch All ONUs
Retrieve all ONUs with optional pagination.
| Property | Value |
|---|---|
| Endpoint | Fetch All ONUs |
| Method | GET |
| URL | /api/v1/onus |
| Authentication | Bearer Token |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
per_page | integer | No | Results per page (default: 50) |
olt_id | integer | No | Filter by OLT |
status | string | No | Filter by status (online, offline, critical) |
Success Response (200 OK):
json
{
"success": true,
"data": {
"onus": [
{
"id": 1,
"serial_number": "HWTC12345678",
"olt_id": 1,
"subscriber_id": 1,
"subscriber_name": "John Doe",
"rx_power": -18.5,
"tx_power": 2.1,
"status": "online",
"last_seen": "2024-01-15 10:30:00"
}
],
"total": 150
}
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/onus?per_page=50" \
-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/onus', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'query' => [
'per_page' => 50,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const params = new URLSearchParams({
per_page: 50,
});
const response = await fetch(`${BASE_URL}/api/v1/onus?${params}`, {
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/onus",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
params={
"per_page": 50,
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/onus"
q := url.Values{}
q.Set("per_page", "50")
endpoint += "?" + q.Encode()
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/onus"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.query(&[
("per_page", "50"),
])
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch Critical ONUs
Retrieve ONUs with critical signal levels or issues.
| Property | Value |
|---|---|
| Endpoint | Fetch Critical ONUs |
| Method | GET |
| URL | /api/v1/onus/critical |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 5,
"serial_number": "HWTC87654321",
"subscriber_name": "Jane Doe",
"rx_power": -28.5,
"issue": "Low RX Power",
"status": "critical"
}
]
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/onus/critical" \
-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/onus/critical', [
'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/onus/critical`, {
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/onus/critical",
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/onus/critical"
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/onus/critical"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Get ONU By Id
Retrieve details of a specific ONU.
| Property | Value |
|---|---|
| Endpoint | Get ONU By Id |
| Method | GET |
| URL | /api/v1/onus/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | ONU ID |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"serial_number": "HWTC12345678",
"olt_id": 1,
"olt_name": "OLT-Main",
"subscriber_id": 1,
"subscriber_name": "John Doe",
"rx_power": -18.5,
"tx_power": 2.1,
"temperature": 45,
"voltage": 3.3,
"status": "online",
"uptime": "15 days",
"last_seen": "2024-01-15 10:30:00"
}
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/onus/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']);
$onuId = 1;
$response = $client->request('GET', "/api/v1/onus/{$onuId}", [
'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 onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onus/${onuId}`, {
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"
onu_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/onus/{onu_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() {
onuId := 1
endpoint := baseURL + "/api/v1/onus/" + strconv.Itoa(onuId)
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 onu_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/onus/{onu_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Get ONU Signal History
Retrieve signal history for an ONU over a specified time period.
| Property | Value |
|---|---|
| Endpoint | Get ONU Signal History |
| Method | GET |
| URL | /api/v1/onus/{id}/signal-history |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | ONU ID |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
hours | integer | No | Hours of history (default: 24) |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"timestamp": "2024-01-15 10:00:00",
"rx_power": -18.5,
"tx_power": 2.1
},
{
"timestamp": "2024-01-15 09:00:00",
"rx_power": -18.3,
"tx_power": 2.0
}
]
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/onus/1/signal-history?hours=24" \
-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']);
$onuId = 1;
$response = $client->request('GET', "/api/v1/onus/{$onuId}/signal-history", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'query' => [
'hours' => 24,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const onuId = 1;
const params = new URLSearchParams({
hours: 24,
});
const response = await fetch(`${BASE_URL}/api/v1/onus/${onuId}/signal-history?${params}`, {
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"
onu_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/onus/{onu_id}/signal-history",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
params={
"hours": 24,
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
onuId := 1
endpoint := baseURL + "/api/v1/onus/" + strconv.Itoa(onuId) + "/signal-history"
q := url.Values{}
q.Set("hours", "24")
endpoint += "?" + q.Encode()
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 onu_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/onus/{onu_id}/signal-history"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.query(&[
("hours", "24"),
])
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Refresh ONU Metrics
Refresh metrics for a single ONU.
| Property | Value |
|---|---|
| Endpoint | Refresh ONU Metrics |
| Method | POST |
| URL | /api/v1/onus/{id}/refresh-metrics |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | ONU ID |
Success Response (200 OK):
json
{
"success": true,
"message": "Metrics refreshed",
"data": {
"rx_power": -18.5,
"tx_power": 2.1,
"status": "online"
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/onus/1/refresh-metrics" \
-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']);
$onuId = 1;
$response = $client->request('POST', "/api/v1/onus/{$onuId}/refresh-metrics", [
'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 onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onus/${onuId}/refresh-metrics`, {
method: 'POST',
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"
onu_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/onus/{onu_id}/refresh-metrics",
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() {
onuId := 1
endpoint := baseURL + "/api/v1/onus/" + strconv.Itoa(onuId) + "/refresh-metrics"
req, _ := http.NewRequest("POST", 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 onu_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/onus/{onu_id}/refresh-metrics"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Bulk Refresh ONU Metrics
Refresh metrics for multiple ONUs at once.
| Property | Value |
|---|---|
| Endpoint | Bulk Refresh ONU Metrics |
| Method | POST |
| URL | /api/v1/onus/bulk-refresh |
| 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
{
"onu_ids": [1, 2, 3]
}| Parameter | Type | Required | Description |
|---|---|---|---|
onu_ids | array | Yes | Array of ONU IDs to refresh |
Success Response (200 OK):
json
{
"success": true,
"message": "Bulk refresh completed",
"data": {
"refreshed": 3,
"failed": 0
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/onus/bulk-refresh" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"onu_ids": [
1,
2,
3
]
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('POST', '/api/v1/onus/bulk-refresh', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'onu_ids' => [
1,
2,
3,
],
],
]);
$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/onus/bulk-refresh`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
onu_ids: [
1,
2,
3,
],
}),
});
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/onus/bulk-refresh",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"onu_ids": [
1,
2,
3,
],
},
)
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/onus/bulk-refresh"
payload, _ := json.Marshal(map[string]any{
"onu_ids": []any{
1,
2,
3,
},
})
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/onus/bulk-refresh"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"onu_ids": [
1,
2,
3
]
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}OLT Management (CRUD)
The following endpoints use the
/api/v1/olt/prefix (new CRUD controller). The legacy read-only endpoints above use/api/v1/olts/and/api/v1/onus/.
Fetch All OLTs (CRUD)
| Property | Value |
|---|---|
| Method | GET |
| URL | /api/v1/olt |
| Authentication | Bearer Token |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/olt?isp_id=1&branch_id=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']);
$response = $client->request('GET', '/api/v1/olt', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'query' => [
'isp_id' => 1,
'branch_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const params = new URLSearchParams({
isp_id: 1,
branch_id: 1,
});
const response = await fetch(`${BASE_URL}/api/v1/olt?${params}`, {
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/olt",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
params={
"isp_id": 1,
"branch_id": 1,
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/olt"
q := url.Values{}
q.Set("isp_id", "1")
q.Set("branch_id", "1")
endpoint += "?" + q.Encode()
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/olt"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.query(&[
("isp_id", "1"),
("branch_id", "1"),
])
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch OLT (CRUD)
| Property | Value |
|---|---|
| Method | GET |
| URL | /api/v1/olt/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | OLT ID |
Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/olt/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']);
$oltId = 1;
$response = $client->request('GET', "/api/v1/olt/{$oltId}", [
'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 oltId = 1;
const response = await fetch(`${BASE_URL}/api/v1/olt/${oltId}`, {
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"
olt_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/olt/{olt_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() {
oltId := 1
endpoint := baseURL + "/api/v1/olt/" + strconv.Itoa(oltId)
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 olt_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/olt/{olt_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Create OLT
| Property | Value |
|---|---|
| Method | POST |
| URL | /api/v1/olt |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01",
"ip_address": "192.168.1.1",
"vendor_id": 1
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/olt" \
-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": "OLT-01",
"ip_address": "192.168.1.1",
"vendor_id": 1
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('POST', '/api/v1/olt', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'name' => 'OLT-01',
'ip_address' => '192.168.1.1',
'vendor_id' => 1,
],
]);
$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/olt`, {
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: 'OLT-01',
ip_address: '192.168.1.1',
vendor_id: 1,
}),
});
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/olt",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01",
"ip_address": "192.168.1.1",
"vendor_id": 1,
},
)
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/olt"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01",
"ip_address": "192.168.1.1",
"vendor_id": 1,
})
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/olt"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01",
"ip_address": "192.168.1.1",
"vendor_id": 1
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Update OLT
| Property | Value |
|---|---|
| Method | PUT |
| URL | /api/v1/olt/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01 Updated"
}Code Examples:
bash
curl -X PUT "https://your-domain.com/api/v1/olt/1" \
-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": "OLT-01 Updated"
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$oltId = 1;
$response = $client->request('PUT', "/api/v1/olt/{$oltId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'name' => 'OLT-01 Updated',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const oltId = 1;
const response = await fetch(`${BASE_URL}/api/v1/olt/${oltId}`, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
name: 'OLT-01 Updated',
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
olt_id = 1
response = requests.put(
f"{BASE_URL}/api/v1/olt/{olt_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01 Updated",
},
)
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() {
oltId := 1
endpoint := baseURL + "/api/v1/olt/" + strconv.Itoa(oltId)
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01 Updated",
})
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 olt_id = 1;
let response = client
.put(format!("{BASE_URL}/api/v1/olt/{olt_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "OLT-01 Updated"
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Delete OLT
| Property | Value |
|---|---|
| Method | DELETE |
| URL | /api/v1/olt/{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 | Acting user ID |
Code Examples:
bash
curl -X DELETE "https://your-domain.com/api/v1/olt/1?isp_id=1&branch_id=1&user_id=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']);
$oltId = 1;
$response = $client->request('DELETE', "/api/v1/olt/{$oltId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'query' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const oltId = 1;
const params = new URLSearchParams({
isp_id: 1,
branch_id: 1,
user_id: 1,
});
const response = await fetch(`${BASE_URL}/api/v1/olt/${oltId}?${params}`, {
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"
olt_id = 1
response = requests.delete(
f"{BASE_URL}/api/v1/olt/{olt_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
params={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
oltId := 1
endpoint := baseURL + "/api/v1/olt/" + strconv.Itoa(oltId)
q := url.Values{}
q.Set("isp_id", "1")
q.Set("branch_id", "1")
q.Set("user_id", "1")
endpoint += "?" + q.Encode()
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 olt_id = 1;
let response = client
.delete(format!("{BASE_URL}/api/v1/olt/{olt_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.query(&[
("isp_id", "1"),
("branch_id", "1"),
("user_id", "1"),
])
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Get ONUs By OLT
List all ONUs belonging to a specific OLT.
| Property | Value |
|---|---|
| Method | GET |
| URL | /api/v1/olt/{oltId}/onus |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
oltId | integer | Yes | OLT ID |
Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/olt/1/onus" \
-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']);
$oltId = 1;
$response = $client->request('GET', "/api/v1/olt/{$oltId}/onus", [
'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 oltId = 1;
const response = await fetch(`${BASE_URL}/api/v1/olt/${oltId}/onus`, {
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"
olt_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/olt/{olt_id}/onus",
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() {
oltId := 1
endpoint := baseURL + "/api/v1/olt/" + strconv.Itoa(oltId) + "/onus"
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 olt_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/olt/{olt_id}/onus"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}ONU Management (CRUD)
The following endpoints use the
/api/v1/onu/prefix (new CRUD controller).
Fetch All ONUs (CRUD)
| Property | Value |
|---|---|
| Method | GET |
| URL | /api/v1/onu |
| Authentication | Bearer Token |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/onu?isp_id=1&branch_id=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']);
$response = $client->request('GET', '/api/v1/onu', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'query' => [
'isp_id' => 1,
'branch_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const params = new URLSearchParams({
isp_id: 1,
branch_id: 1,
});
const response = await fetch(`${BASE_URL}/api/v1/onu?${params}`, {
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/onu",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
params={
"isp_id": 1,
"branch_id": 1,
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/onu"
q := url.Values{}
q.Set("isp_id", "1")
q.Set("branch_id", "1")
endpoint += "?" + q.Encode()
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/onu"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.query(&[
("isp_id", "1"),
("branch_id", "1"),
])
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch ONU (CRUD)
| Property | Value |
|---|---|
| Method | GET |
| URL | /api/v1/onu/{id} |
| Authentication | Bearer Token |
Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/onu/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']);
$onuId = 1;
$response = $client->request('GET', "/api/v1/onu/{$onuId}", [
'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 onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onu/${onuId}`, {
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"
onu_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/onu/{onu_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() {
onuId := 1
endpoint := baseURL + "/api/v1/onu/" + strconv.Itoa(onuId)
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 onu_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/onu/{onu_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Create ONU
| Property | Value |
|---|---|
| Method | POST |
| URL | /api/v1/onu |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"olt_id": 1,
"mac_address": "AA:BB:CC:DD:EE:FF",
"serial_number": "SN001"
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/onu" \
-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,
"olt_id": 1,
"mac_address": "AA:BB:CC:DD:EE:FF",
"serial_number": "SN001"
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('POST', '/api/v1/onu', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'olt_id' => 1,
'mac_address' => 'AA:BB:CC:DD:EE:FF',
'serial_number' => 'SN001',
],
]);
$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/onu`, {
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,
olt_id: 1,
mac_address: 'AA:BB:CC:DD:EE:FF',
serial_number: 'SN001',
}),
});
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/onu",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"olt_id": 1,
"mac_address": "AA:BB:CC:DD:EE:FF",
"serial_number": "SN001",
},
)
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/onu"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"olt_id": 1,
"mac_address": "AA:BB:CC:DD:EE:FF",
"serial_number": "SN001",
})
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/onu"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"olt_id": 1,
"mac_address": "AA:BB:CC:DD:EE:FF",
"serial_number": "SN001"
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Update ONU
| Property | Value |
|---|---|
| Method | PUT |
| URL | /api/v1/onu/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"serial_number": "SN001-updated"
}Code Examples:
bash
curl -X PUT "https://your-domain.com/api/v1/onu/1" \
-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,
"serial_number": "SN001-updated"
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$onuId = 1;
$response = $client->request('PUT', "/api/v1/onu/{$onuId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'serial_number' => 'SN001-updated',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onu/${onuId}`, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
serial_number: 'SN001-updated',
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
onu_id = 1
response = requests.put(
f"{BASE_URL}/api/v1/onu/{onu_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"serial_number": "SN001-updated",
},
)
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() {
onuId := 1
endpoint := baseURL + "/api/v1/onu/" + strconv.Itoa(onuId)
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"serial_number": "SN001-updated",
})
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 onu_id = 1;
let response = client
.put(format!("{BASE_URL}/api/v1/onu/{onu_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"serial_number": "SN001-updated"
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Delete ONU
| Property | Value |
|---|---|
| Method | DELETE |
| URL | /api/v1/onu/{id} |
| Authentication | Bearer Token |
Code Examples:
bash
curl -X DELETE "https://your-domain.com/api/v1/onu/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']);
$onuId = 1;
$response = $client->request('DELETE', "/api/v1/onu/{$onuId}", [
'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 onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onu/${onuId}`, {
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"
onu_id = 1
response = requests.delete(
f"{BASE_URL}/api/v1/onu/{onu_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() {
onuId := 1
endpoint := baseURL + "/api/v1/onu/" + strconv.Itoa(onuId)
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 onu_id = 1;
let response = client
.delete(format!("{BASE_URL}/api/v1/onu/{onu_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Assign Subscriber to ONU
Map a subscriber to an ONU device.
| Property | Value |
|---|---|
| Method | POST |
| URL | /api/v1/onu/{id}/assign-subscriber |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/onu/1/assign-subscriber" \
-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,
"subscriber_id": 1
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$onuId = 1;
$response = $client->request('POST', "/api/v1/onu/{$onuId}/assign-subscriber", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'subscriber_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onu/${onuId}/assign-subscriber`, {
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,
subscriber_id: 1,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
onu_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/onu/{onu_id}/assign-subscriber",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
},
)
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() {
onuId := 1
endpoint := baseURL + "/api/v1/onu/" + strconv.Itoa(onuId) + "/assign-subscriber"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1,
})
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 onu_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/onu/{onu_id}/assign-subscriber"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"subscriber_id": 1
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Unassign Subscriber from ONU
Remove the subscriber mapping from an ONU device.
| Property | Value |
|---|---|
| Method | POST |
| URL | /api/v1/onu/{id}/unassign-subscriber |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/onu/1/unassign-subscriber" \
-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
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$onuId = 1;
$response = $client->request('POST', "/api/v1/onu/{$onuId}/unassign-subscriber", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const onuId = 1;
const response = await fetch(`${BASE_URL}/api/v1/onu/${onuId}/unassign-subscriber`, {
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,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
onu_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/onu/{onu_id}/unassign-subscriber",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
},
)
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() {
onuId := 1
endpoint := baseURL + "/api/v1/onu/" + strconv.Itoa(onuId) + "/unassign-subscriber"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
})
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 onu_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/onu/{onu_id}/unassign-subscriber"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}