NICE re/streamer pro

Guides

Web API: manage subscribers from your system

Connect your billing or website to the panel: add, change, delete and read subscribers, see who is watching and change channel sources – one encrypted GET request each.

1Set the key

Configuration → WEB management → Wapi aes key:iv → Generate → Save. Both values are 16 characters. Without them the API answers {"info":"key_err"}.

Configuration → WEB management: Wapi aes key and iv with the Generate button
Keep the key secret

Anyone with the key can manage your subscribers. The same key is used by the DVR (see “NICE DVR”) – after changing it, update it there too. Older documentation showed one fixed key for everybody: do not use it, generate your own.

2How a request is built

  1. Write the command as JSON, e.g. {"command":"get","user":"alex"}.
  2. Encode it in base64.
  3. Encrypt the base64 text with AES-128-CBC (key, IV) and write the result as hex.
  4. Call http://host:4300/wapi/<hex>.

Answers are {"info":"…"}. get and connections return {"user":"<hex>"} – encrypted the same way: hex → decrypt → base64 → JSON.

3Commands

CommandJSONAnswer
Add{"command":"add","user":"alex","pass":"1234","notes":"test","maxcon":"2","enddate":"2027-01-31","categories":"2,3,4","ip":"","reseller":"","balancer":""}add_ok · add_err · user_exists
Editthe same fields with "command":"edit"edit_ok · edit_err
Delete{"command":"del","user":"alex"}del_ok · del_err
Read one{"command":"get","user":"alex"}the subscriber (encrypted)
Read all{"command":"get","user":"all_users"}all subscribers (encrypted)
Connections{"command":"connections","user":"all_users"}who is watching: user, IP, player, type, channel (encrypted)
Channel sources{"command":"channel","source":"reload","sources":{"12":["http://main/…","http://backup/…"]}}channel_ok · channel_err – sets the main and backup source of channel 12 and restarts it

A read answer after decryption:

[{"id":1,"user":"alex","pass":"1234","categories":"1,14","enddate":1801382400,"notes":"free","maxcon":2,"ip":"","reseller":"","balancer":""}]

4PHP example

<?php
$key = 'YOUR-16-CHAR-KEY';   // Configuration → WEB management → Wapi aes key
$iv  = 'YOUR-16-CHAR-IV.';   // … and iv
$api = 'http://host:4300/wapi/';

function wapi($cmd) {
  global $key, $iv, $api;
  $enc = openssl_encrypt(base64_encode(json_encode($cmd)), 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
  $ans = json_decode(file_get_contents($api . bin2hex($enc)), true);
  if (isset($ans['user'])) {   // get / connections – encrypted
    $dec = openssl_decrypt(hex2bin($ans['user']), 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
    return json_decode(base64_decode($dec), true);
  }
  return $ans;                 // {"info":"add_ok"} …
}

print_r(wapi(['command' => 'add', 'user' => 'alex', 'pass' => '1234', 'notes' => 'test', 'maxcon' => '2',
              'enddate' => '2027-01-31', 'categories' => '2,3,4', 'ip' => '', 'reseller' => '', 'balancer' => '']));
print_r(wapi(['command' => 'get', 'user' => 'alex']));
?>