Splynx API

The bigger business, the bigger amount of customizations and integrations it requires. Splynx provides an easy way to create additional modules or integrate them with 3rd-party software solutions. Splynx system is a powerful set of modules and open application interfaces (API), so we call it a Framework. For administrators, this means almost unlimited possibilities for software customization.

We follow the RESTful principles, so the API is stateless and HTTP methods and response codes are used whenever possible.

Here are the resources that will help you configure API:

  1. Splynx API documentation.
  2. Repository with PHP API class for Splynx ISP Framework.

PHP API example:

<?php
/**
 * Splynx API v.1.0 demo script
 * Author: Ruslan Malymon (Top Net Media s.r.o.)
 * https://splynx.com/wiki/index.php/API - documentation
 */

include 'SplynxApi.php';

$api_url = 'http://splynx/'; // please set your Splynx URL

$key = "3d052b922dc2f44d1d03d957ff5691ba"; // please set your key
$secret = "4d944c2d4d55bd78a1af0f6b8d5958af"; // please set your secret

// don't forget to add permissions to API Key, for changing locations.

$api = new SplynxAPI($api_url, $key, $secret);

$locationsApiUrl = "admin/administration/locations";

print "<pre>";

print "List locations\n";
$result = $api->api_call_get($locationsApiUrl);
print "Result: ";
if ($result) {
    print "Ok!\n";
    print_r($api->response);
} else {
    print "Fail! Error code: $api->response_code\n";
    print_r($api->response);
}
print "\n-------------------------------------------------\n";

print "Create location\n";
$result = $api->api_call_post($locationsApiUrl,
    array(
        'name' => 'API test #' . rand()
    ));

print "Result: ";
if ($result) {
    print "Ok!\n";
    print_r($api->response);
    $locationId = $api->response['id'];
} else {
    print "Fail! Error code: $api->response_code\n";
    print_r($api->response);
    $locationId = false;
}
print "\n-------------------------------------------------\n";

if ($locationId) {

    print "Retrieve location " . $locationId . "\n";
    $result = $api->api_call_get($locationsApiUrl, $locationId);
    print "Result: ";
    if ($result) {
        print "Ok!\n";
        print_r($api->response);
    } else {
        print "Fail! Error code: $api->response_code\n";
        print_r($api->response);
    }
    print "\n-------------------------------------------------\n";


    print "Change created location name\n";
    $result = $api->api_call_put($locationsApiUrl, $locationId, array('name' => 'NAME CHANGED #' . mt_rand()));
    print "Result: ";
    if ($result) {
        print "Ok!\n";
        print_r($api->response);
    } else {
        print "Fail! Error code: $api->response_code\n";
        print_r($api->response);
    }
    print "\n-------------------------------------------------\n";

    print "Retrieve updated info\n";
    $result = $api->api_call_get($locationsApiUrl, $locationId);
    print "Result: ";
    if ($result) {
        print "Ok!\n";
        print_r($api->response);
    } else {
        print "Fail! Error code: $api->response_code\n";
        print_r($api->response);
    }
    print "\n-------------------------------------------------\n";

    print "Delete created location\n";
    $result = $api->api_call_delete($locationsApiUrl, $locationId);
    print "Result: ";
    if ($result) {
        print "Ok!\n";
        print_r($api->response);
    } else {
        print "Fail! Error code: $api->response_code\n";
        print_r($api->response);
    }
    print "\n-------------------------------------------------\n";

}

More in System configuration

System configuration NetFlow Protocol in MikroTik

Understanding NetFlow Protocol in MikroTik: Relevance after the end of support of the IP Accounting in RouterOS 7

In the realm of network management, MikroTik is a popular choice for its robust features and cost-effectiveness. One of ...

System configuration Voip CDR auto processing from FTP server in Splynx

VOIP CDR Auto Processing from FTP Server

Nowadays every business is seeking to achieve the decrease of manual effort in the essential processes. Splynx voice bil...

System configuration

How to configure SMS and email notifications to monitor your device

Your team should be constantly aware of the status of your network. If any device goes down, the system will automatical...

System configuration New business opportunities with Splynx API

Splynx API

Splynx system is a powerful set of modules and open application interfaces (API), so we call it a Framework.

System configuration

Splynx self-registration

Splynx's self-registration functionality allows your clients to register and helps you skip the routine process of addin...

System configuration

Blocking of non-paying customers in Splynx

Splynx blocks non-paying customers automatically. The administrator can also block the customer manually.

System configuration Ubiquiti EdgeRouters pppoe Radius support

Ubiquiti EdgeRouters PPPoE RADIUS support

UBNT EdgeRouters can act as a PPPoE server, with authentication of CPEs, providing statistics, blocking end-users, and s...

Find out how Splynx helps ISPs grow

Learn more