Two methods are provided for accessing the API. The HTTPS API should be used when the system making the call is hosted remotely from an external control panel. This API accepts POST requests to the API endpoint located at: The Direct Socket API should be used when making API calls that relies on real time responses. For instance OnAIR Sign , VU Response , VOIP Telephone or other custom code. The use of the API requires API Authentication Credentials. ('KEY' and 'HASHKEY'). API requests will be authenticated based on the request parameters key and hashkey as provisioned.Getting Started
1. HTTPS API
2. Direct Socket API
Authentication
API Authentication Credentials can be generated for developers by contacting support (developer@zerhex.com).
Authentication is required for each API request.Authenticating With API Credentials
A sample API request thats returns a devices status information
is listed below.<?php
/**
* Zerhex Sample API Call
*
* @package Zerhex Digital
* @author Zerhex <developer@zerhex.com>
* @copyright Copyright (c) Zerhex Digital 20013-2018
* @link http://www.zerhex.com/
*/
$API_URL = "https://www.streamerportal.com/api/api.php";
//POST VARIABLES
$postfields['key'] = '8784lahho0775a00zhj9z704a0a5'; //API KEY
$postfields['hash'] = 'dssa65sta288878221est'; //API secret hash
$postfields['Request'] = 'GET_DEVICE_STATUS';
$postfields['device_serial_id'] = '0B0B0B0B0B0B';
// Call the API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
$response = curl_exec($ch);
if (curl_error($ch)) {
die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
}
curl_close($ch);
// Decode response
$jsonData = json_decode($response,true);
//print return data of page.
echo '<pre>';
print_r($jsonData);
echo '</pre>';
?>