Skip to main content
Skip table of contents

Get URLs for streams publishing: Stream.GetPublishUrls

The method and parameters

Media service returns a publication URL with authorization parameters for each specified stream. If the stream isn’t served by this server or the stream isn’t intended for publication, then falseis returned for the stream.

string Stream.GetPublishUrls(array uids, unsigned ttl).

array uidsREQUIRED – a list of streams for which publication URLs are requested.

unsigned ttl = 3600 – the duration for which the publication URL will be available.

POST /api/

JSON-RPC
JSON
{
    "jsonrpc": "2.0",
    "method": "Stream.GetPublishUrls",
    "params": {
        "uids": [],
        "ttl": 3600
    },
    "id": 1
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/' \
	--header 'Content-Length: 139' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--header 'Authorization: Bearer <api-authorization-token>' \
	--header 'Content-Length: <Content length>' \
	--data '{
    "jsonrpc": "2.0",
    "method": "Stream.GetPublishUrls",
    "params": {
        "uids": [],
        "ttl": 3600
    },
    "id": 1
}'
PHP
PHP
$data = array (
  'jsonrpc' => '2.0',
  'method' => 'Stream.GetPublishUrls',
  'params' => 
  array (
    'uids' => 
    array (
    ),
    'ttl' => 3600,
  ),
  'id' => 1,
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'header' => "Content-Type: application/json\r
Accept: application/json\r
Authorization: Bearer <api-authorization-token>\r
Content-Length: <content length>",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/', false, $context);

200 OK

List of objects with playback URLs

JSON
{
    "camera-uid1-primary": false,
    "camera-uid2-primary": "rtsp://host.tld:554/sink/stream1"
}

400 Bad Request

json-rpc error

JSON
{
    "error": {
        "code": -32601,
        "message": "Method not found"
    }
}

500 Internal Server Error

The server error

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.