Getting data left on account with api


#1

Hey guys i would like to have a little python app that the client can just click on to tell him how much data he has left?
All internet services are uncapped and then get capped via the fup? Is there a way to read the info of the fup say of a 5 gig account?

The app would get the pppoe ip then go lookup the ip…linked to account and then from there pull data to check how much data is left?


#2

Hi,
try to use this script:

#!/usr/bin/php
<?php
include './SplynxApi.php'; // API source

$api_url = 'http://XXX.XXX.XX.XX/'; // please set your Splynx URL
$key = "XXXXXXXXXXXXXXXXXXX"; // please set your key
$secret = "XXXXXXXXXXXXXXXXXXX"; // please set your secret
$api = new SplynxAPI($api_url, $key, $secret);

$ApiUrlSearch = "admin/customers/customer/0/internet-services";
$ApiUrl = "admin/fup/counter";

$ipv4 = '10.10.10.5'; // client ip-address 

$params = [
            'main_attributes' => [
                'ipv4' => $ipv4,
		'status' => 'active'
            ]
        ];

$api->api_call_get($ApiUrlSearch . '?' . http_build_query($params));
$id_arr = ($api->response);
$id = $id_arr[0]['id'];

$result = $api->api_call_get($ApiUrl, $id);
		print_r($api->response);	          // this is your result !!! 

?>

and don’t forget about API-key permissions

WBR, Splynx team