OpenBroadcaster Documentation

App Key Requests

OpenBroadcaster supports making requests to controllers from remote locations as well, using App Keys. These can be defined by in the user management model, in the account management screen of anyone with the 'manage_appkeys' permission.

An example of an App Keys request to OpenBroadcaster with jQuery can be found below:

var xhr = $.ajax( {
  'async': true,
  'type': 'POST',
  'url': 'https://openbroadcaster-server-location.com/api.php',
  'dataType': 'json',
  'data': {
    "c": "media",
    "a": "search",
    "d": JSON.stringify({
      "save_history": true,
      "sort_by": "updated",
      "sort_dir":"desc",
      "q": {"mode": "simple", "string": "xyz"},
      "s": "approved",
      "l": 250,
      "o": 0,
      "my": false
    }),
    "appkey": "APPKEYHERE"
  },
  'success': function (response) {
    console.log(response);
  }
});

Note that the above requires a working jQuery installation, and the 'url' and 'appkey' parameters need to be replaced with ones set up for the OpenBroadcaster installation.

A server-side request in PHP is also possible:

$url = "https://openbroadcaster-server-location.com/api.php";
$data = http_build_query([
  'c' => 'media',
  'a' => 'search',
  'd' => json_encode([
    'save_history' => true,
    'sort_by'      => 'updated',
    'sort_dir'     => 'desc',
    'q'            => ['mode' => 'simple', 'string' => 'xyz'],
    's'            => 'approved',
    'l'            => 250,
    'o'            => 0,
    'my'           => false
  ]),
  'appkey' => 'APPKEYHERE'
]);

$context_options = [
  'http' => [
    'method'  => 'POST',
    'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
                 "Content-length: " . strlen($data) . "\r\n",
    'content' => $data
  ]
];

$context = stream_context_create($context_options);
$result = file_get_contents($url, false, $context);

echo $result;