API Documents


Developers Unite!!!
Our Restful Documentation


General

The API is built on HTTP. Our API is RESTful and it:

  • Uses predictable, resource-oriented URLs.
  • Uses built-in HTTP capabilities for passing parameters and authentication.
  • Responds with standard HTTP response codes to indicate errors.
  • Returns JSON.

We have Libraries for various languages. You may use our libraries, or your favorite HTTP/REST library available for your programming language, to make HTTP calls to the API.

To give you an idea of how to use the API, we have annotated our documentation with code samples written in several popular programming languages. Use the language selector at the top to switch between them.


Base URL

All API URLs referenced in this documentation start with the following base part:

https://sys.yourdomain.com/api/v2/

Currently API supports only GET requests.


Authentication

You authenticate to the API by providing your API key in the request. You can manage your API key in the ‘Settings’ tab.

https://sys.yourdomain.com/api/v2/{endpoint}?key={yourkey}

All calls require authentication to the API.


Response Codes

The API returns standard HTTP response codes.

Code Description
200 Everything worked as expected
400 Bad Request - Often missing a required parameter
401 Unauthorized - No valid API key provided
404 Not found - Requested resource not found

Date Format

The API returns JSON for all API calls. JSON does not have a built-in date type, dates are passed as strings encoded according to ISO 8601. This format that is output:

2017-05-12T04:10:21.000Z

(Complete date plus hours and minutes and seconds)


Additional parameters

You can add additional GET params to your query. Each value must be appended to your link with & symbol.

Available params:

  • results - count of items in response array. Default value: 25.

    You can pass results param to all endpoints that return an array of values.

    For example, if you want to fetch only 5 locations, your request will look like:

    https://sys.yourdomain.com/api/v2/me/locations?key={yourkey}&results=5

  • page - used to skip first elements in response array. Default value: 1.

    You can pass page param to all endpoints that return an array of values to make pagination.

    For example, to skip first 10 locations and fetch next 10 you may use this URL:

    https://sys.yourdomain.com/api/v2/me/locations?key={yourkey}&page=2&results=10

Endpoints


Locations

Endpoint Description Response type
me/locations get locations array
me/location/{id} get location info object
me/location/{id}/routers get location routers array
me/location/{id}/sensors get location sensors array
me/location/{id}/visitors get location visitors array

Routers

Endpoint Description Response type
me/routers get routers array
me/router/{id} get router info object

Sensors

Endpoint Description Response type
me/sensors get sensors array
me/sensor/{id} get sensor info object


Examples


Get locations

Get 50 locations:

https://sys.yourdomain.com/api/v2/me/locations?key={yourkey}&page=1&results=50

$url = 'https://sys.yourdomain.com/api/v2/me/locations?key={yourkey}&page=1&results=50';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if (!empty($ch_data)) {
    $json_data = json_decode($ch_data, true);
    print_r($json_data);
} else {
    echo 'Sorry, but there was a problem connecting to the API.';
}

$(document).ready(function() {
    var url='https://sys.yourdomain.com/api/v2/me/locations?key={yourkey}&page=1&results=50';
    $.getJSON(url, function(data) {
        console.log(data);
    });
});

Example response:

[
    {
        "location_id": 1,
        "location_name": "Example Location",
        "location_address_lat": "91.212606",
        "location_address_lon": "-46.18974300000002",
        "location_address_number": "123",
        "location_address_street": "Example Street",
        "location_address_city": "Omaha",
        "location_address_state": "NE",
        "location_address_zipcode": "12345",
        "location_address_country": "United States",
        "location_address_timezone": null,
        "location_redirection_url": "https://google.com",
        "router_sticker_ids": [11, 22],
        "sensor_sticker_ids": [33, 44]
    }
]


Get location info

Get location info:

https://sys.yourdomain.com/api/v2/me/location/{id}?key={yourkey}

$url = 'https://sys.yourdomain.com/api/v2/me/location/{id}?key={yourkey}';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if (!empty($ch_data)) {
    $json_data = json_decode($ch_data, true);
    print_r($json_data);
} else {
    echo 'Sorry, but there was a problem connecting to the API.';
}

$(document).ready(function() {
    var url='https://sys.yourdomain.com/api/v2/me/location/{id}?key={yourkey}';
    $.getJSON(url, function(data) {
        console.log(data);
    });
});

Example response:

{
    "location_id": 1,
    "location_name": "Example Location",
    "location_address_lat": "91.212606",
    "location_address_lon": "-46.18974300000002",
    "location_address_number": "123",
    "location_address_street": "Example Street",
    "location_address_city": "Omaha",
    "location_address_state": "NE",
    "location_address_zipcode": "12345",
    "location_address_country": "United States",
    "location_address_timezone": null,
    "location_redirection_url": "https://google.com",
    "router_sticker_ids": [11, 22],
    "sensor_sticker_ids": [33, 44]
}


Get location routers

Get 50 routers:

https://sys.yourdomain.com/api/v2/me/location/{id}/routers?key={yourkey}&page=1&results=50

$url = 'https://sys.yourdomain.com/api/v2/me/location/{id}/routers?key={yourkey}&page=1&results=50';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ch_data = curl_exec($ch);
curl_close($ch);

if (!empty($ch_data)) {
    $json_data = json_decode($ch_data, true);
    print_r($json_data);
} else {
    echo 'Sorry, but there was a problem connecting to the API.';
}

$(document).ready(function() {
    var url='https://sys.yourdomain.com/api/v2/me/location/{id}/routers?key={yourkey}&page=1&results=50';
    $.getJSON(url, function(data) {
        console.log(data);
    });
});

Example response:

[
    {
        "mac_id": 3,
        "mac_name": "11-11-11-11-11-11",
        "location_id": 123,
        "created_on": "2017-05-26T08:45:40.000Z",
        "session_timeout": "300",
        "landing_page": "