The Sensorpro API is a RESTful JSON-based API. Its functionality is exposed through well-defined web URLs that follow standard conventions using an easy-to-read data format.
Values which need to be substituted into URLs will be denoted in square brackets.
Each response contains a result object. The result object is used to determine if a request failed and to get any status messages which may be available for this request. The structure of the result object is shown below.
"Result": {
"RequestId": "00000000-0000-0000-0000-000000000000",
"ErrorMessages": [],
"StatusMesssages": [],
"TotalStatusMessages": 0,
"TotalErrors": 0
}
The authorisation API must be called to get an access token which is then used to authenticate subsequent API calls. The API is locked down by IP address you will need to contact support to get your IP address whitelisted. This should be the IP address of the machine where the API calls originate.
https://apinie.sensorpro.net/auth/sys/signin
| Header | Example | Description |
|---|---|---|
| Content-Type | application/json; | |
| x-apikey | {API KEY VALUE} | Retrieved from API keys - Use menu "API" | "API keys" Select "Sensorpro rest API default key". Whitelist the calling ip address by editing the api key properties. |
{
"Organization": "YOURORGANIZATION",
"User": "APIUSER",
"Password":"PASSWORD"
}
{
"ExpiresIn": 3622,
"APIEndpoint": "https://apinie.sensorpro.net/",
"Token": "59701e8b-a6c4-43f0-a7a6-af05ccf8a60d",
"Result": {
"RequestId": "00000000-0000-0000-0000-000000000000",
"ErrorMessages": [],
"StatusMesssages": [],
"TotalStatusMessages": 0,
"TotalErrors": 0
}
}
var client = new RestClient("https://apinie.sensorpro.net/auth/sys/Signin");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-apikey", "5f9b1bb2-1850-42a6-a6f7-7848b8d3708d");
request.AddParameter("application/json", "{ "Organization": "YOURORGANIZATION", "User": "YOURUSER", "Password":"YOURPASSWORD"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://apinie.sensorpro.net/auth/sys/Signin',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'
{
"Organization": "YOURORGANIZATION",
"User": "YOURUSER",
"Password":"YOURPASSWORD"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'x-apikey: 5f9b1bb2-1850-42a6-a6f7-7848b8d3708d'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ "Organization": "YOURORGANIZATION", "User": "YOURUSER", "Password":"YOURPASSWORD"}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/auth/sys/Signin")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("x-apikey", "5f9b1bb2-1850-42a6-a6f7-7848b8d3708d")
.build();
Response response = client.newCall(request).execute();
Use this API call to log off the session.
https://apinie.sensorpro.net/auth/sys/logoff/[Token]
| Header | Example | Description |
|---|---|---|
| Content-Type | application/json; |
There is no response for this API call.
var client = new RestClient("https://apinie.sensorpro.net/auth/sys/logoff/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json;");
IRestResponse response = client.Execute(request);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/auth/sys/logoff/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json;"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/auth/sys/logoff/[Token]")
.post(null)
.addHeader("Content-Type", "application/json;")
.build();
Response response = client.newCall(request).execute();