The REGISTER_SERIAL parameter is used to register a new device along with a new username.
This request should be used once per user account creation.
Parameters
Description
Email address will be used as username for all future requests
password
Password user will use for future logins
firstname
First name will be use as owner identifier
lastname
Use as owner identifier .
sn
The serial number of the device being registered with new account
timezones
Required to use schedule features. If this timezone is incorrect schedule features will not work correctly.
Example usage :
<?php $API_URL = "https://www.streamerportal.com/api/api.php"; $postfields['key'] = '8784lahho0775a00zhj9z704a0a5'; //API KEY $postfields['hash'] = 'dssa65sta288878221est'; //API secret hash $postfields['Request'] = 'REGISTER_SERIAL'; $postfields['email'] = 'demo@example.com'; $postfields['password'] = '8784lahho0775a00zhj9z704a0a5'; $postfields['firstname'] = 'John'; $postfields['lastname'] = 'Doe'; $postfields['sn'] = '0B0B0B0B0B0B'; $postfields['timezones'] = 'America/New_York'; // 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>'; ?>
<?php Array ( [ret_code] => SUCCESS [msg] => ACCOUNT SUCCESSFULLY CREATED [response] => Array ( [ret] => 1 [user_data] => Array ( [account_id] => 493 [profile_id] => 2501 [title] => Default Title [channel] => 107 [username] => demo@example.com [firstname] => John [lastname] => Doe ) [device] => Array ( [0B0B0B0B0B0B] => B0B0B0B0B0B ) [timezone] => Array ( [zone] => America/New_York [id] => 17 [code] => -05:00 ) [link] => Array ( [PLS] => http://page.streamerportal.com/play/PLS/2501/play [M3U] => http://page.streamerportal.com/play/M3U/2501/play [RAM] => http://page.streamerportal.com/play/RAM/2501/play [ASX] => http://page.streamerportal.com/play/ASX/2501/play [AUDIO] => http://page.streamerportal.com/play/AUDIO/2501/play [XML] => http://page.streamerportal.com/play/XML/2501/play [JSON] => http://page.streamerportal.com/play/JSON/2501/play ) ) ) ?>