Difference between revisions of "Content ID Generation"
(Новая страница: «'''Content ID''' - это уникальный идентификатор транспортного файла в системе ACE Stream. Для получен…») |
|||
Line 1: | Line 1: | ||
− | '''Content ID''' | + | '''Content ID''' is a unique identifier of a transport file in ACE Stream system. |
− | + | To receive Content ID you have to send HTTP POST request to the address <nowiki>http://api.torrentstream.net/upload/raw</nowiki>. In body of the request you have to transfer content of the transport file, base64-encoded. Respond in JSON format: | |
− | * | + | * if successful: <tt>{"content_id": "xxxx"}</tt> |
− | * | + | * if an error is occured: <tt>{"error": "error description"}</tt> |
− | == | + | == Example of using on php == |
<tt><nowiki> | <tt><nowiki> | ||
<?php | <?php |
Latest revision as of 12:08, 6 September 2017
Content ID is a unique identifier of a transport file in ACE Stream system.
To receive Content ID you have to send HTTP POST request to the address http://api.torrentstream.net/upload/raw. In body of the request you have to transfer content of the transport file, base64-encoded. Respond in JSON format:
- if successful: {"content_id": "xxxx"}
- if an error is occured: {"error": "error description"}
Example of using on php
<?php $api_url = 'http://api.torrentstream.net/upload/raw'; try { $path = '/path/to/file.acelive'; $data = file_get_contents($path); $opts = array( 'http' => array( 'method' => 'POST', 'header' => "Content-Type: application/octet-stream\r\n", 'content'=> base64_encode($data) ) ); $ctx = stream_context_create($opts); $response = file_get_contents($api_url, false, $ctx); echo $response . "\n"; } catch(Exception $e) { echo $e->getMessage() . "\n"; } ?>