A Brief Introduction to the QuadraNet API

Author: Dallin Wellington

Recently I have received multiple inquiries from people about how to use our API in their own projects and what is needed to access it. So I put together a small introduction and have written a simple PHP class for accessing our API.

Accessing the API is done through the HTTPS protocol. In this article, the language of choice will be PHP, but any programming language with the ability to make requests to the web can access our API.

Start off by DOWNLOADING the PHP class script (QuadranetApi.php) and extracting it to your projects source directory.

In this example, we will be creating a simple PHP script which outputs basic information about a device returned from the API.

Begin by including the QuadraNetAPI class at the beginning of the script using ‘require_once’:

require_once(__DIR__ . ‘/QuadranetApi.php’);


Next, create a QuadraNetApi class instance, using your username and password as the constructor arguments:


$api = new QuadranetApi(‘username’, ‘password’);


Then, we will call the API method “device/device_details”, which will fetch our devices information  and return it to us in the form of an array (to see the keys of this array, use print_r( ) ). The second parameter to the call function is the list of parameters being passed to the API method, which is in this case is the id of the device.

$my_device = $api->call(‘device/device_details’, array(‘device’ => ‘274’));

Now, we will output the information we received back from the API to the console:


            echo ‘Server: ‘ . $my_device[‘device’][‘label’] . “n”;

            echo ‘————————————————‘ . “n”;

            echo ‘Device Id: ‘ . $my_device[‘device’][‘id’] . “n”;

            echo ‘Operating System: ‘ . $my_device[‘device’][‘OS’] . ‘ ‘ . $my_device[‘device’][‘OS_architecture’] . “n”;

            echo ‘Description: ‘. $my_device[‘device’][‘description’] . “n”;

            echo ‘Primary Public Ip: ‘ . $my_device[‘device’][‘public_ip’] . “n”;

            echo ‘Primary Private Ip: ‘ . $my_device[‘device’][‘private_ip’] . “n”;

            echo ‘Public Network Cap: ‘ . $my_device[‘device’][‘public_cap’] . “n”;

            echo ‘Private Network Cap: ‘ . $my_device[‘device’][‘private_cap’] . “n”;


Example Source: Download

QuadraNetAPI PHP Class: Download (Example source included)

Get Involved with the QuadraNet Community! Join our Community Forum!