API v2.0 Notes

SSL only

We require that all requests are done over SSL.

UTF-8 encoding

Every string passed to and from the API needs to be UTF-8 encoded.

Date format

All dates in the API are strings in the following format: "2013-05-21 17:53:39".

Authentication

The API uses HTTP Basic Authentication, which is secure since all requests use SSL.

The API key can be specified in the authentication section of the request. If your language requires a username and password, enter the API key in the username and leave the password empty.

Your API key can be generated from the Control Center > Tools & Settings > API Keys menu.

Sample cURL code

curl -v -H 'sn-apikey: ***' -X GET https://api.hotspotsystem.com/v2.0/locations

More on cURL command line tool

Sample PHP code

$api_key = '***';
$root = 'https://api.hotspotsystem.com/v2.0';
$url = $root . '/locations';
$headers = array(
  'sn-apikey: ' . $api_key
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);

$response = curl_exec($ch);
$info = curl_getinfo($ch);

if ($info['http_code'] === 200) {
  // Do something with the response
  $json = json_decode($response, true)
}

curl_close($ch);

More on PHP's Client URL Library

Link Header

The pagination info is included in the Link header. Follow these values instead of constructing your own URLs.

Link: <https://api.hotspotsystem.com/v2.0/locations?limit=10&offset=0>; rel="self", <https://api.hotspotsystem.com/v2.0/locations?limit=10&offset=10>; rel="next"

The possible rel values are:

Name Description
self The link relation for the current page of results.
next The link relation for the immediate next page of results.
prev The link relation for the immediate previous page of results.

More on the Link header

API v1.0 - Deprecated

For older implementations please check API v1.0 Documentation