MODI Portal Captive Portal Hotspot API

API Key and Password :

To find out your API Key and create your API Password, log in to your panel and then create your API Password from the system settings section on the home page.

General Response Codes :

ErrorCode101 :API Key or API Password is Invalid.
ErrorCode5 :JSON Error


USER ADD

JSON :

{
"api_key":"YOUR_API_KEY",
"api_password":"YOUR_API_PASSWORD",
"process":"useradd",
"detail":{
"username":"USERNAME",
"password":"PASSWORD",
"usergroupid":"USER_GROUP_ID",
"downloadspeed":"DOWNLOAD_SPEED",
"uploadspeed":"UPLOAD_SPEED",
"simuleconn":"SIMULATE_CONNECTION",
"enddate":"END_DATE"
}
}

PHP EXAMPLE :

$url = 'YOUR_LOGIN_URL/api.php';
$data = array("api_key" => "YOUR_API_KEY",
"api_password" => "12345",
"process" => "useradd",
"detail" => array(
"username"=>"test",
"password"=>"test12345",
"usergroupid"=>"1",
"downloadspeed"=>"2048",
"uploadspeed"=>"1024",
"simuleconn"=>"2",
"enddate"=>"02-04-2024"));

$postdata = json_encode($data);

$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
print_r ($result);

Response Codes :

ResponseCode101 :User added successfully
ErrorCode102 :User available


USER DELETE

JSON :

{
"api_key":"YOUR_API_KEY",
"api_password":"YOUR_API_PASSWORD",
"process":"userdelete",
"detail":{
"username":"USERNAME"
}
}

PHP EXAMPLE :

$url = 'YOUR_LOGIN_URL/api.php';
$data = array("api_key" => "YOUR_API_KEY",
"api_password" => "12345",
"process" => "userdelete",
"detail" => array(
"username"=>"test"));

$postdata = json_encode($data);

$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
print_r ($result);

Response Codes :

ResponseCode103 :User deleted successfully
ErrorCode104 :System Error


USER LIST

JSON :

{
"api_key":"YOUR_API_KEY",
"api_password":"YOUR_API_PASSWORD",
"process":"userlist"
}

PHP EXAMPLE :

$url = 'YOUR_LOGIN_URL/api.php';
$data = array("api_key" => "YOUR_API_KEY",
"api_password" => "123",
"process" => "userlist");

$postdata = json_encode($data);

$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
print_r (json_decode($result, true));

Response :

Array
(
    [0] => Array
        (
            [username] => test1
            [detail] => Array
                (
                    [password] => 123
                    [usergroupid] => 1
                    [downloadspeed] => 5192
                    [uploadspeed] => 2048
                    [simuleconn] => 1
                    [enddate] => 28 Mar 2024 00:00:00
                )

        )

    [1] => Array
        (
            [username] => test2
            [detail] => Array
                (
                    [password] => 456
                    [usergroupid] => 2
                    [downloadspeed] => 2048
                    [uploadspeed] => 1024
                    [simuleconn] => 1
                    [enddate] => 31 May 2024 00:00:00
                )

        )
)

Response Codes:

ErrorCode104 :System Error


USER LIST BY GROUP ID

JSON :

{
"api_key":"YOUR_API_KEY",
"api_password":"YOUR_API_PASSWORD",
"process":"userlistgroupid",
"detail":{"groupid":"GROUP_ID"}
}

PHP EXAMPLE :

$url = 'YOUR_LOGIN_URL/api.php';
$data = array("api_key" => "YOUR_API_KEY",
"api_password" => "123",
"process" => "userlistgroupid",
"detail" => array("groupid"=>"GROUP_ID"));

$postdata = json_encode($data);

$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
print_r (json_decode($result, true));

Response :

Array
(
    [0] => Array
        (
            [username] => test1
            [password] => 123
            [usergroupid] => 1
            [downloadspeed] => 5192
            [uploadspeed] => 2048
            [simuleconn] => 1
            [enddate] => 28 Mar 2024 00:00:00
        )

    [1] => Array
        (
            [username] => test2
            [password] => 456
            [usergroupid] => 2
            [downloadspeed] => 2048
            [uploadspeed] => 1024
            [simuleconn] => 1
            [enddate] => 31 May 2024 00:00:00
        )
)

Response Codes:

ErrorCode104 :System Error


USER DETAILS

JSON :

{
"api_key":"YOUR_API_KEY",
"api_password":"YOUR_API_PASSWORD",
"process":"userdetail",
"detail":{"username":"test2"}
}

PHP EXAMPLE :

$url = 'YOUR_LOGIN_URL/api.php';
$data = array("api_key" => "YOUR_API_KEY",
"api_password" => "123",
"process" => "userdetail",
"detail" => array("username"=>"test2"));

$postdata = json_encode($data);

$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
print_r (json_decode($result, true));

Response :

Array
(
    [0] => Array
        (
            [username] => test2
            [detail] => Array
                (
                    [password] => 456
                    [usergroupid] => 2
                    [downloadspeed] => 2048
                    [uploadspeed] => 1024
                    [simuleconn] => 1
                    [enddate] => 31 May 2024 00:00:00
                )

        )
)

Response Codes:

ErrorCode104 :System Error