Skip to content

User - MAC Binding ​

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

Admin endpoints for managing MAC address bindings for subscribers. All endpoints require admin/staff authentication.


Fetch All MAC Bindings ​

Retrieve all MAC address bindings.

PropertyValue
EndpointFetch All MAC Bindings
MethodGET
URL/api/v1/mac-binding
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Success Response (200 OK):

json
{
    "success": true,
    "data": [
        {
            "id": 1,
            "subscriber_id": 1,
            "subscriber_name": "John Doe",
            "mac_address": "AA:BB:CC:DD:EE:FF",
            "created_at": "2024-01-15 10:30:00"
        }
    ]
}

Code Examples:

bash
curl -X GET "https://your-domain.com/api/v1/mac-binding" \
  -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/mac-binding', [
    '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/mac-binding`, {
  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/mac-binding",
    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/mac-binding"

	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/mac-binding"))
        .header("Accept", "application/json")
        .bearer_auth(TOKEN)
        .send()
        .await?;

    let data: serde_json::Value = response.json().await?;
    println!("{data:#}");
    Ok(())
}

Fetch Subscriber MAC ​

Retrieve MAC binding for a specific subscriber.

PropertyValue
EndpointFetch Subscriber MAC
MethodGET
URL/api/v1/mac-binding/{id}
AuthenticationBearer Token

Success Response (200 OK):

json
{
    "success": true,
    "data": {
        "subscriber_id": 1,
        "subscriber_name": "John Doe",
        "mac_address": "AA:BB:CC:DD:EE:FF"
    }
}

Code Examples:

bash
curl -X GET "https://your-domain.com/api/v1/mac-binding/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']);

$macBindingId = 1;

$response = $client->request('GET', "/api/v1/mac-binding/{$macBindingId}", [
    '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 macBindingId = 1;

const response = await fetch(`${BASE_URL}/api/v1/mac-binding/${macBindingId}`, {
  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"

mac_binding_id = 1

response = requests.get(
    f"{BASE_URL}/api/v1/mac-binding/{mac_binding_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() {
	macBindingId := 1
	endpoint := baseURL + "/api/v1/mac-binding/" + strconv.Itoa(macBindingId)

	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 mac_binding_id = 1;

    let response = client
        .get(format!("{BASE_URL}/api/v1/mac-binding/{mac_binding_id}"))
        .header("Accept", "application/json")
        .bearer_auth(TOKEN)
        .send()
        .await?;

    let data: serde_json::Value = response.json().await?;
    println!("{data:#}");
    Ok(())
}

Bind MAC ​

Bind a MAC address to a subscriber.

PropertyValue
EndpointBind MAC
MethodPOST
URL/api/v1/mac-binding/bind
AuthenticationBearer Token

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1,
    "subscriber_id": 1,
    "mac_address": "AA:BB:CC:DD:EE:FF"
}
ParameterTypeRequiredDescription
subscriber_idintegerYesSubscriber ID
mac_addressstringYesMAC address to bind

Success Response (200 OK):

json
{
    "success": true,
    "message": "MAC address bound successfully"
}

Code Examples:

bash
curl -X POST "https://your-domain.com/api/v1/mac-binding/bind" \
  -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,
    "mac_address": "AA:BB:CC:DD:EE:FF"
  }'
php
<?php

require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client(['base_uri' => 'https://your-domain.com']);

$response = $client->request('POST', '/api/v1/mac-binding/bind', [
    'headers' => [
        'Accept'        => 'application/json',
        'Authorization' => 'Bearer your-auth-token',
    ],
    'json' => [
        'isp_id'        => 1,
        'branch_id'     => 1,
        'user_id'       => 1,
        'subscriber_id' => 1,
        'mac_address'   => 'AA:BB:CC:DD:EE:FF',
    ],
]);

$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/mac-binding/bind`, {
  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,
    mac_address: 'AA:BB:CC:DD:EE:FF',
  }),
});

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/mac-binding/bind",
    headers={
        "Accept": "application/json",
        "Authorization": f"Bearer {TOKEN}",
    },
    json={
        "isp_id": 1,
        "branch_id": 1,
        "user_id": 1,
        "subscriber_id": 1,
        "mac_address": "AA:BB:CC:DD:EE:FF",
    },
)

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/mac-binding/bind"

	payload, _ := json.Marshal(map[string]any{
		"isp_id":        1,
		"branch_id":     1,
		"user_id":       1,
		"subscriber_id": 1,
		"mac_address":   "AA:BB:CC:DD:EE:FF",
	})
	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/mac-binding/bind"))
        .header("Accept", "application/json")
        .bearer_auth(TOKEN)
        .json(&json!({
            "isp_id": 1,
            "branch_id": 1,
            "user_id": 1,
            "subscriber_id": 1,
            "mac_address": "AA:BB:CC:DD:EE:FF"
        }))
        .send()
        .await?;

    let data: serde_json::Value = response.json().await?;
    println!("{data:#}");
    Ok(())
}

Unbind MAC ​

Remove MAC binding from a subscriber.

PropertyValue
EndpointUnbind MAC
MethodPOST
URL/api/v1/mac-binding/unbind
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": "MAC address unbound successfully"
}

Code Examples:

bash
curl -X POST "https://your-domain.com/api/v1/mac-binding/unbind" \
  -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']);

$response = $client->request('POST', '/api/v1/mac-binding/unbind', [
    '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 response = await fetch(`${BASE_URL}/api/v1/mac-binding/unbind`, {
  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"

response = requests.post(
    f"{BASE_URL}/api/v1/mac-binding/unbind",
    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"
)

const baseURL = "https://your-domain.com"
const token = "your-auth-token"

func main() {
	endpoint := baseURL + "/api/v1/mac-binding/unbind"

	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 response = client
        .post(format!("{BASE_URL}/api/v1/mac-binding/unbind"))
        .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(())
}

www.onezeroart.com