Methods: bulkinfo | info | create | upload | update | delete

bulkinfo

Get information about media by one or several codes

Input parameters

Required parameters:

  • String apikey (Project API key)
  • Array code[] (List of media codes; a single code may be passed as code=)

Optional parameters:

  • Integer skip_not_found (1 — do not treat a batch with no resolvable code as an error: Status: Success with an empty Items is returned instead; default 0)

How a batch is resolved

  • Items contains only the media found in the project (and its child projects). Codes that did not resolve are listed separately: in Deleted when the media was deleted, in NotFound when the code is unknown or belongs to another project.
  • Duplicate and empty codes in code[] are ignored.
  • When no code resolves, the method returns Status: Failed, Message: Media not found and ErrorCode: MEDIA_NOT_FOUND; NotFound and Deleted are present in that response as well. With skip_not_found=1 the same batch returns Status: Success with an empty Items.
  • Media without a finished poster are returned with an empty Poster.

Output parameters

  • String Code (Media code)
  • String Title (Title of media file)
  • String Type (Media type)
  • Integer Width (Video width)
  • Integer Height (Video height)
  • Integer FileSize (Original file size)
  • String FileName (Original filename)
  • String MediaStatus (Status of media file)
  • Integer Duration (Video duration in seconds)
  • String Description (Media description)
  • String CreatedAt (Creation date)
  • String PlayerLink (Player link)
  • String PlayerCode (Player HTML code)
  • Object Poster (Poster information with Code, Width, Height, Url)
  • Object Timeline - PreviewsVtt (VTT file format for timeline frames)

Response-level fields:

  • Array Items (List of media found)
  • Array NotFound (Codes that did not resolve to a media of the project)
  • Array Deleted (Codes of deleted media of the project)
  • String ErrorCode (Only with Status: Failed; for this method — MEDIA_NOT_FOUND)

Example request:

Text
https://boomstream.com/api/media/bulkinfo?apikey=[API_KEY]&code[]=[MEDIA_CODE_1]&code[]=[MEDIA_CODE_2]&code[]=[MEDIA_CODE_N]

Example request where a batch with no resolvable code is not an error:

Text
https://boomstream.com/api/media/bulkinfo?apikey=[API_KEY]&code[]=[MEDIA_CODE_1]&code[]=[MEDIA_CODE_2]&skip_not_found=1

Example response:

XML
<Response>
    <Items>
        <Item>
            <Code>xxxxxxxx</Code>
            <Title>test - 2024-03-13 16:45:09</Title>
            <Type>video</Type>
            <Width>1280</Width>
            <Height>720</Height>
            <FileSize>1000000</FileSize>
            <FileName>test.mp4</FileName>
            <MediaStatus>Done</MediaStatus>
            <Duration>6</Duration>
            <Description/>
            <CreatedAt>2024-03-13 16:45:09</CreatedAt>
            <PlayerLink>https://play.boomstream.com/xxxxxxxx</PlayerLink>
            <PlayerCode><iframe width="{{width}}" height="{{height}}" src="https://play.boomstream.com/xxxxxxxx" frameborder="0" scrolling="no" allowfullscreen=""></iframe></PlayerCode>
            <Poster>
                <Code>h7sZjLB9-a1</Code>
                <Width>1280</Width>
                <Height>720</Height>
                <Url>https://bs.boomstream.com/adaptive/xxxxxxxx.jpg</Url>
            </Poster>
            <Timeline>
                <PreviewsVtt>https://bs.boomstream.com/adaptive/xxxxxxxx/playlist.vtt</PreviewsVtt>
            </Timeline>
        </Item>
    </Items>
    <NotFound>
        <Item>yyyyyyyy</Item>
    </NotFound>
    <Deleted>
        <Item>zzzzzzzz</Item>
    </Deleted>
    <Status>Success</Status>
</Response>

In this example media xxxxxxxx was found, code yyyyyyyy is unknown and zzzzzzzz was deleted. In JSON (format=json) NotFound and Deleted are arrays of strings:

JSON
{"Items":[{"Code":"xxxxxxxx","MediaStatus":"Done"}],"NotFound":["yyyyyyyy"],"Deleted":["zzzzzzzz"],"Status":"Success"}

Example response when no code resolves (without skip_not_found):

XML
<Response>
    <Message>Media not found</Message>
    <ErrorCode>MEDIA_NOT_FOUND</ErrorCode>
    <NotFound>
        <Item>yyyyyyyy</Item>
    </NotFound>
    <Deleted/>
    <Status>Failed</Status>
</Response>

info

Get additional information about media by its code

Input parameters

Required parameters:

  • String apikey (Project API key)
  • String code (Media code)

Output parameters

  • String Title (Title of media file)
  • String Code (Media code)
  • String Type (Media type)
  • Integer Width (Video width)
  • Integer Height (Video height)
  • Integer FileSize (Original file size)
  • String FileName (Original filename)
  • String MediaStatus (Status of media file)
  • Integer Duration (Video duration in seconds)
  • String PlayerCode (Player HTML code)
  • String DownloadLink (Download link for original file)
  • Object Poster (Poster information with Code, Width, Height, Url)
  • Array Transcodes (List of transcoding qualities with processing status; null if there are no qualities)
  • Array Screenshots (List of screenshots with Code, Width, Height, Url)
  • Object Timeline (Timeline information with Sprites, FullSprite, Previews, PreviewsVtt)

Transcodes item:

  • String Code (Transcode code; empty until the quality is ready)
  • String Title (Quality name, e.g. 1080p)
  • Integer Width (Width)
  • Integer Height (Height)
  • Integer FileSize (File size; empty until the quality is ready)
  • String Status (Quality processing status: Queued, Processing, Done, Error)
  • String PseudoMP4, AppleHLS (Links to the quality file; empty until the quality is ready)

Transcodes lists all qualities of the video, including those still being processed. Links and file size are filled in only for qualities with status Done.

Example request:

Text
https://boomstream.com/api/media/info?apikey=[API_KEY]&code=[MEDIA_CODE]

Example response:

XML
<Response>
    <Title>demovideo.avi</Title>
    <Code>xxxxxx</Code>
    <Type>video</Type>
    <Width>1600</Width>
    <Height>900</Height>
    <FileSize>1000000</FileSize>
    <FileName>test.mp4</FileName>
    <MediaStatus>Done</MediaStatus>
    <Duration>61</Duration>
    <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; 
       height=&quot;{{height}}&quot; 
       src=&quot;https://play.boomstream.com/xxxxxx&quot; 
       frameborder=&quot;0&quot; 
       scrolling=&quot;no&quot; 
       allowfullscreen&gt;&lt;/iframe&gt;
    </PlayerCode>
    <DownloadLink>
       https://bs.boomstream.com/balancer/hash:abd6c666f029e065e4aedb44e5c5f176/xxxxxx.orig
    </DownloadLink>
    <Poster>
        <Code>xxxxxx-a1</Code>
        <Width>1600</Width>
        <Height>900</Height>
        <Url>https://bs.boomstream.com/balancer/xxxxxx-a1.jpg</Url>
    </Poster>
    <Transcodes>
        <Item>
            <Code>xxxxxx-xxxxxx</Code>
            <Title>1080p</Title>
            <Width>1600</Width>
            <Height>900</Height>
            <FileSize>52428800</FileSize>
            <Status>Done</Status>
            <PseudoMP4>https://bs.boomstream.com/balancer/xxxxxx-xxxxxx.mp4</PseudoMP4>
            <AppleHLS>https://bs.boomstream.com/balancer/xxxxxx-xxxxxx/playlist.m3u8</AppleHLS>
        </Item>
        <Item>
            <Code/>
            <Title>720p</Title>
            <Width>1280</Width>
            <Height>720</Height>
            <FileSize/>
            <Status>Processing</Status>
            <PseudoMP4/>
            <AppleHLS/>
        </Item>
    </Transcodes>
    <Adaptive/>
    <Screenshots>
        <Item>
            <Code>xxxxxx-a21</Code>
            <Width>1600</Width>
            <Height>900</Height>
            <Url>https://bs.boomstream.com/balancer/xxxxxx-a21.jpg</Url>
        </Item>
    </Screenshots>
    <Timeline>
        <Sprites>
            <Item>
                <Code>xxxxxxxx-s1</Code>
                <Width>800</Width>
                <Height>450</Height>
                <FrameCount>25</FrameCount>
                <Url>https://bs.boomstream.com/balancer/xxxxxxxx-s1.webp</Url>
            </Item>
        </Sprites>
        <FullSprite>
            <Code>xxxxxxxx-f</Code>
            <Width>1600</Width>
            <Height>630</Height>
            <FrameCount>61</FrameCount>
            <Url>https://bs.boomstream.com/balancer/xxxxxxxx-f.webp</Url>
        </FullSprite>
        <Previews>
            <Item>
                <Code>xxxxxxxx-t1</Code>
                <Width>160</Width>
                <Height>90</Height>
                <TimePosition>0.00</TimePosition>
                <SpriteURL>https://bs.boomstream.com/balancer/xxxxxxxx-s1.webp</SpriteURL>
                <SpriteURLxywh>https://bs.boomstream.com/balancer/xxxxxxxx-s1.webp#xywh=0,0,160,90</SpriteURLxywh>
                <SpritePosition>[0, 0, 160, 90]</SpritePosition>
            </Item>
        </Previews>
        <PreviewsVtt>https://bs.boomstream.com/adaptive/xxxxxxxx/playlist.vtt</PreviewsVtt>
    </Timeline>
    <Status>Success</Status>
</Response>

create

Create new media file

Input parameters

Required parameters:

  • String apikey (Project API key)
  • String title (Media title)
  • String link (Reference to the source)

Optional parameters:

  • String folderCode (Code of folder)

Output parameters

  • String Code (Media code)

Example request:

Text
https://boomstream.com/api/media/create?apikey=[API_KEY]&link=http://example.com/video.mp4&title=temp

Example response:

XML
<Response>
    <Code>dNO6bnZE</Code>
    <Status>Success</Status>
</Response>

upload

Upload new media file through an HTML form

Step 1: Get data for upload form

Input parameters

Required parameters:

  • String apikey (Project API key)
  • String title (Media title)

Optional parameters:

  • String folderCode (Code of folder)

Example request:

Text
https://boomstream.com/api/media/upload?apikey=[API_KEY]&title=temp

Example response:

XML
<Response>
    <UploadUrl>
        https://node.org/upload/hash:8d7cd/f1a05782f77aca5cc78647178110ac8a
    </UploadUrl>
    <ProgressBarUrl>
        https://boomstream.com/api/media/progressbar
    </ProgressBarUrl>
    <Status>Success</Status>
</Response>

Step 2: Create upload page

Create a page, e.g., "upload.php". Add an iframe tag to the body and insert the UploadUrl parameter.

Sample code:

HTML
<body>
    <iframe src="https://localhost/iframe.php?link=<UploadUrl>">
</body>

Step 3: Create iframe page

Create a page for the "Browse" button, which will be displayed in the frame — iframe.php.

Sample code:

HTML
<script type="text/javascript">
    function submitForm() {
        parent.runUpload();
        $('#form1').submit();
    }
</script>

<form action="<UploadUrl>" method="POST" enctype="multipart/form-data" id="form1">
    <input type="file" name="file" onchange="submitForm()">
</form>

Step 4: Create progress bar proxy script

Create a proxy script to get upload status — progressbar.php.

Sample code:

Bash
<?php
    $progressBarUrl = (isset($_GET['progressBarUrl'])) ? $_GET['progressBarUrl'] : '';
    echo @file_get_contents($progressBarUrl . '&format=json');
?>

Step 5: Add JavaScript to track upload progress

Add JavaScript code on the page upload.php to send requests to progressbar.php every second.

Sample code:

HTML
<script type="text/javascript">
    var refreshIntervalId;
    var refresh = 1000;
    function runUpload() {
        $('#form1').submit();
        refreshIntervalId = setTimeout('getPercent()', refresh);
    }
    
    function getPercent(){
        $.get('https://localhost/progressbar.php', {progressBarUrl:"<progressBarUrl>"}, function(data){
            if(data.Action=='done') {
                console.log("DONE");
            } else {
                refreshIntervalId = setTimeout('getPercent()', refresh);
            }
        },'json');
    }
</script>

Progress response during upload:

XML
<Response>
    <Percent>10</Percent>
    <Action>work</Action>
    ...
</Response>

Success response when upload is complete:

XML
<Response>
    <Action>done</Action>
    <Code>dsadas13</Code>
    ...
</Response>

update

Update parameters of media or reupload the original

Input parameters

Required parameters:

  • String apikey (Project API key)
  • String code (Media code)

Optional parameters:

  • String title (Media title)
  • String link (Reference to the source)

Example request:

Text
https://boomstream.com/api/media/update?apikey=[API_KEY]&code=[MEDIA_CODE]&link=http://example.com/video.mp4&title=test2

Example response:

XML
<Response>
    <Status>Success</Status>
</Response>

delete

Delete media file

Input parameters

Required parameters:

  • String apikey (Project API key)
  • String code (Media code)

Example request:

Text
https://boomstream.com/api/media/delete?apikey=[API_KEY]&code=[MEDIA_CODE]

Example response:

XML
<Response>
    <Status>Success</Status>
</Response>