API

This sections demonstrates the use of the API interface to communicate directly with supported devices.

Request Parameter

The SELECT_SERVER_PROFILE parameter is used to select preconfigured server configuration previously saved by using the ADD_SERVER_PROFILE request

Request = SELECT_SERVER_PROFILE

Parameters

Description

device_serial_id

device's serial number for profile selection

server_id

the ID of the profile configuration to select for this device. Please use the LIST_SERVER_PROFILE request to get a list of all available broadcast configuration profiles. Use the ADD_SERVER_PROFILE configuration to create new configuration.


Example usage :

Untitled Document
<?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'] = 'SELECT_SERVER_PROFILE';  //request

$postfields['device_serial_id'] = '0B0B0B0B0B0B';  //device serial id
$postfields['server_id'] = '95';   //profile id. Use LIST_SERVER_PROFILE request to get all available ids



// 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>';


?>

Sample Response

<?php

Array
(
    [success] => 1
    [ret_code] => SUCCESS
    [msg] => PROFILE ID [95] SUCCESSFULLY SELECTED FOR DEVICE ID = [0B0B0B0B0B0B]
    [response] => Array
        (
            [valid] => 1
            [msg] => PROFILE ID [95] SUCCESSFULLY SELECTED FOR DEVICE ID = [0B0B0B0B0B0B]
        )

)

?>