# Live

Методы: [info](#info) | [list](#list) | [create](#create) | [update](#update) | [record](#record) | [delete](#delete) | [restream](#restream)

## info

*Получение информации о трансляции по её коду*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)
* *String* **code** (Код трансляции)

#### Выходные параметры

* *String* **Title** (Название трансляции)
* *String* **Code** (Код трансляции)
* *String* **PublishKey** (Ключ трансляции)
* *String* **EncoderLink** (Ссылка на энкодер)
* *Boolean* **OnlineStatus** (Статус вещания)
* *Boolean* **RecordStatus** (Статус записи)
* *Integer* **Concurrent** (Количество одновременных зрителей)
* *String* **CreationDate** (Дата создания)
* *String* **PlayerCode** (HTML-код плеера)
* *String* **Poster.Code** (Код постера)
* *Integer* **Poster.Width** (Ширина постера)
* *Integer* **Poster.Height** (Высота постера)
* *String* **Poster.Url** (Ссылка на постер)
* *String* **Screenshots.Item.Code** (Код скриншота)
* *Integer* **Screenshots.Item.Width** (Ширина скриншота)
* *Integer* **Screenshots.Item.Height** (Высота скриншота)
* *String* **Screenshots.Item.Url** (Ссылка на скриншот)
* *Boolean* **DvrStatus** (Статус функции DVR)
* *Array* **Recordings.Item** (Массив записей, структура идентична объекту Media info)

Пример запроса:

```text
https://boomstream.com/api/live/info?apikey=[API_KEY]&code=xxxxxxxx
```

Пример ответа:

```xml
<Response>
    <Title>Promo</Title>
    <Code>xxxxxxxx</Code>
    <PublishKey>xxxxxxxx</PublishKey>
    <EncoderLink>
        https://boomstream.com/api/live/encoder?hash=xxxxxxxxxxxxxxxxx&code=xxxxxxxx
    </EncoderLink>
    <OnlineStatus>True</OnlineStatus>
    <RecordStatus>True</RecordStatus>
    <Concurrent>10</Concurrent>
    <CreationDate>2015-01-29 15:05:58</CreationDate>
    <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; height=&quot;{{height}}&quot;
src=&quot;https://boomstream.com/player.html?code=xxxxxxxx&quot; frameborder=&quot;0&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;</PlayerCode>
    <Poster>
        <Code>xxxxxxxx-m3</Code>
        <Width>1920</Width>
        <Height>1080</Height>
        <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
    </Poster>
    <Screenshots>
        <Item>
            <Code>xxxxxxxx-m3</Code>
            <Width>1920</Width>
            <Height>1080</Height>
            <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
        </Item>
    </Screenshots>
    <Recordings>
        <Item>
            <Title>Promo recording</Title>
            <Code>xxxxxxxx</Code>
            <Type>video</Type>
            <Width>640</Width>
            <Height>352</Height>
            <MediaStatus>Done</MediaStatus>
            <Duration>5</Duration>
            <PlayerCode>&amp;lt;iframe width=&amp;quot;{{width}}&amp;quot; height=&amp;quot;{{height}}&amp;quot; src=&amp;quot;https://play.boomstream.com/xxxxxxxx&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;</PlayerCode>
            <DownloadLink>https://bs.boomstream.com/balancer/hash:6a3ef95256df7b0cfa24dcbf9002d211/xxxxxxxxx.orig</DownloadLink>
            <Poster>
                <Code>hh1VIHbe-a1</Code>
                <Width>352</Width>
                <Height>640</Height>
                <Url>https://bs.boomstream.com/balancer/hh1VIHbe-a1.jpg</Url>
            </Poster>
            <Transcodes>
                <Item>
                    <Code>hh1VIHbe-H63Th2OK</Code>
                    <Title>240p</Title>
                    <Width>132</Width>
                    <Height>240</Height>
                    <PseudoMP4>https://bs.boomstream.com/balancer/hh1VIHbe-H63Th2OK.mp4</PseudoMP4>
                    <AppleHLS>https://bs.boomstream.com/balancer/hh1VIHbe-H63Th2OK/playlist.m3u8</AppleHLS>
                </Item>
                <Item>
                    <Code>hh1VIHbe-5SQ8X51e</Code>
                    <Title>360p</Title>
                    <Width>198</Width>
                    <Height>360</Height>
                    <PseudoMP4>https://bs.boomstream.com/balancer/hh1VIHbe-5SQ8X51e.mp4</PseudoMP4>
                    <AppleHLS>https://bs.boomstream.com/balancer/hh1VIHbe-5SQ8X51e/playlist.m3u8</AppleHLS>
                </Item>
            </Transcodes>
            <Adaptive>
                <AppleHLS>https://bs.boomstream.com/adaptive/hh1VIHbe/playlist.m3u8</AppleHLS>
            </Adaptive>
            <Screenshots>
                <Item>
                    <Code>hh1VIHbe-a1</Code>
                    <Width>352</Width>
                    <Height>640</Height>
                    <Url>https://bs.boomstream.com/balancer/hh1VIHbe-a1.jpg</Url>
                </Item>
                <Item>
                    <Code>hh1VIHbe-a2</Code>
                    <Width>352</Width>
                    <Height>640</Height>
                    <Url>https://bs.boomstream.com/balancer/hh1VIHbe-a2.jpg</Url>
                </Item>
                <Item>
                    <Code>hh1VIHbe-a3</Code>
                    <Width>352</Width>
                    <Height>640</Height>
                    <Url>https://bs.boomstream.com/balancer/hh1VIHbe-a3.jpg</Url>
                </Item>
                <Item>
                    <Code>hh1VIHbe-a4</Code>
                    <Width>352</Width>
                    <Height>640</Height>
                    <Url>https://bs.boomstream.com/balancer/hh1VIHbe-a4.jpg</Url>
                </Item>
                <Item>
                    <Code>hh1VIHbe-a5</Code>
                    <Width>352</Width>
                    <Height>640</Height>
                    <Url>https://bs.boomstream.com/balancer/hh1VIHbe-a5.jpg</Url>
                </Item>
            </Screenshots>
        </Item>
    </Recordings>
    <DvrStatus>False</DvrStatus>
    <Status>Success</Status>
</Response>
```

## list

*Получение списка трансляций*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)

#### Выходные параметры

* *String* **Title** (Название трансляции)
* *String* **Code** (Код трансляции)
* *String* **PublishKey** (Ключ трансляции)
* *String* **EncoderLink** (Ссылка на энкодер)
* *Boolean* **OnlineStatus** (Статус вещания)
* *Boolean* **RecordStatus** (Статус записи)
* *Integer* **Concurrent** (Количество одновременных зрителей)
* *String* **CreationDate** (Дата создания)
* *String* **PlayerCode** (HTML-код плеера)
* *String* **Poster.Code** (Код постера)
* *Integer* **Poster.Width** (Ширина постера)
* *Integer* **Poster.Height** (Высота постера)
* *String* **Poster.Url** (Ссылка на постер)
* *String* **Screenshots.Item.Code** (Код скриншота)
* *Integer* **Screenshots.Item.Width** (Ширина скриншота)
* *Integer* **Screenshots.Item.Height** (Высота скриншота)
* *String* **Screenshots.Item.Url** (Ссылка на скриншот)
* *Array* **Recordings.Item** (Массив записей)

Пример запроса:

```text
https://boomstream.com/api/live/list?apikey=[API_KEY]
```

Пример ответа:

```xml
<Response>
    <Lives>
       <Item>
          <Title>Promo</Title>
          <Code>xxxxxxxx</Code>
          <PublishKey>xxxxxxxx</PublishKey>
          <EncoderLink>
              https://boomstream.com/api/live/encoder?hash=xxxxxxxxxxxxxxxxx&code=xxxxxxxx
          </EncoderLink>
          <OnlineStatus>True</OnlineStatus>
          <RecordStatus>True</RecordStatus>
          <Concurrent>10</Concurrent>
          <CreationDate>2015-01-29 15:05:58</CreationDate>
          <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; height=&quot;{{height}}&quot;
src=&quot;https://boomstream.com/player.html?code=xxxxxxxx&quot; frameborder=&quot;0&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;</PlayerCode>
          <Poster>
             <Code>xxxxxxxx-m3</Code>
             <Width>1920</Width>
             <Height>1080</Height>
             <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
          </Poster>
          <Screenshots>
             <Item>
                <Code>xxxxxxxx-m3</Code>
                <Width>1920</Width>
                <Height>1080</Height>
                <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
             </Item>
          </Screenshots>
          <Recordings/>
       </Item>
    </Lives>
    <Status>Success</Status>
</Response>
```

## create

*Создание новой трансляции*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)
* *String* **title** (Название трансляции)

Необязательные параметры:

* *Integer* **autorecord** (Автозапись) 1-Да, 0-Нет
* *Integer* **show_records** (Показывать записи) 1-Да, 0-Нет
* *Date* **start_date** (Таймер обратного отсчёта в формате Y-m-d H:i:s)
* *String* **timezone** (Временная зона, по умолчанию Europe/Moscow)
* *String* **filetemplate** (Шаблон именования файлов)
  * По умолчанию: `%name% - %date% %time%`
  * Доступные переменные: `%index%`, `%name%`, `%date%`, `%time%`
* *Integer* **folder** (Сохранять в папку Live) 1-Да, 0-Нет
* *Integer* **rotation** (Ротация записей в минутах, макс. 1440)
* *String* **offlinetitle** (Офлайн-сообщение)
* *String* **description** (Описание для интерфейса страницы)
* *Integer* **dvr** (Включение DVR) 1-Да, 0-Нет

#### Выходные параметры

* *String* **Title** (Название трансляции)
* *String* **Code** (Код трансляции)
* *String* **PublishKey** (Ключ трансляции)
* *String* **EncoderLink** (Ссылка на энкодер)
* *Boolean* **OnlineStatus** (Статус вещания)
* *Boolean* **RecordStatus** (Статус записи)
* *Integer* **Concurrent** (Количество одновременных зрителей)
* *String* **CreationDate** (Дата создания)
* *String* **PlayerCode** (HTML-код плеера)
* *Object* **Poster** (Информация о постере)
* *Array* **Screenshots** (Список скриншотов)
* *Boolean* **DvrStatus** (Статус DVR)

Пример запроса:

```text
https://boomstream.com/api/live/create?apikey=[API_KEY]&title=temp
```

Пример ответа:

```xml
<Response>
    <Title>Promo</Title>
    <Code>xxxxxxxx</Code>
    <PublishKey>xxxxxxxx</PublishKey>
    <EncoderLink>
        https://boomstream.com/api/live/encoder?hash=xxxxxxxxxxxxxxxxx&code=xxxxxxxx
    </EncoderLink>
    <OnlineStatus>True</OnlineStatus>
    <RecordStatus>True</RecordStatus>
    <Concurrent>10</Concurrent>
    <CreationDate>2015-01-29 15:05:58</CreationDate>
    <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; height=&quot;{{height}}&quot;
src=&quot;https://boomstream.com/player.html?code=xxxxxxxx&quot; frameborder=&quot;0&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;</PlayerCode>
    <Poster>
        <Code>xxxxxxxx-m3</Code>
        <Width>1920</Width>
        <Height>1080</Height>
        <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
    </Poster>
    <Screenshots>
        <Item>
            <Code>xxxxxxxx-m3</Code>
            <Width>1920</Width>
            <Height>1080</Height>
            <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
        </Item>
    </Screenshots>
    <DvrStatus>False</DvrStatus>
    <Status>Success</Status>
</Response>
```

## update

*Обновление параметров трансляции*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)
* *String* **code** (Код трансляции)

Необязательные параметры:

* *String* **title** (Название трансляции)
* *Integer* **autorecord** (Автозапись) 1-Да, 0-Нет
* *Integer* **show_records** (Показывать записи) 1-Да, 0-Нет
* *String* **filetemplate** (Шаблон именования файлов)
* *Integer* **folder** (Сохранять в папку Live) 1-Да, 0-Нет
* *Integer* **rotation** (Ротация записей в минутах)
* *String* **offlinetitle** (Офлайн-сообщение)
* *String* **description** (Описание)
* *Integer* **dvr** (Включение DVR) 1-Да, 0-Нет

#### Выходные параметры

Структура ответа идентична методу [create](#create).

Пример запроса:

```text
https://boomstream.com/api/live/update?apikey=[API_KEY]&code=xxxxxxxx&title=temp
```

Пример ответа:

```xml
<Response>
    <Title>Promo</Title>
    <Code>xxxxxxxx</Code>
    <PublishKey>xxxxxxxx</PublishKey>
    <EncoderLink>
        https://boomstream.com/api/live/encoder?hash=xxxxxxxxxxxxxxxxx&code=xxxxxxxx
    </EncoderLink>
    <OnlineStatus>True</OnlineStatus>
    <RecordStatus>True</RecordStatus>
    <Concurrent>10</Concurrent>
    <CreationDate>2015-01-29 15:05:58</CreationDate>
    <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; height=&quot;{{height}}&quot;
src=&quot;https://boomstream.com/player.html?code=xxxxxxxx&quot; frameborder=&quot;0&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;</PlayerCode>
    <Poster>
        <Code>xxxxxxxx-m3</Code>
        <Width>1920</Width>
        <Height>1080</Height>
        <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
    </Poster>
    <Screenshots>
        <Item>
            <Code>xxxxxxxx-m3</Code>
            <Width>1920</Width>
            <Height>1080</Height>
            <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
        </Item>
    </Screenshots>
    <DvrStatus>False</DvrStatus>
    <Status>Success</Status>
</Response>
```

## record

*Запись трансляции*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)
* *String* **code** (Код трансляции)
* *Integer* **record** (Статус записи) 1-Да (запись), 0-Нет (остановить)

Пример запроса:

```text
https://boomstream.com/api/live/record?apikey=[API_KEY]&code=xxxxxxxx&record=1
```

Пример ответа:

```xml
<Response>
    <Status>Success</Status>
</Response>
```

## delete

*Удаление трансляции*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)
* *String* **code** (Код трансляции)

Пример запроса:

```text
https://boomstream.com/api/live/delete?apikey=[API_KEY]&code=xxxxxxxx
```

Пример ответа:

```xml
<Response>
    <Status>Success</Status>
</Response>
```

## restream

*Настройка сервера для мультистриминга*

#### Входные параметры

Обязательные параметры:

* *String* **apikey** (API ключ)
* *String* **code** (Код трансляции)
* *Integer* **server** (Номер сервера в вашем аккаунте, 1-8)
* *String* **server_url** (URL сервера для мультистриминга)
* *String* **stream_key** (Ключ трансляции для мультистриминга)

Необязательные параметры:

* *Boolean* **enable** (Включить/отключить стриминг на сервер)
* *String* **login** (Логин для авторизации на сервере)
* *String* **password** (Пароль для авторизации на сервере)

#### Выходные параметры

Структура ответа идентична методу [info](#info).

Пример запроса:

```text
https://boomstream.com/api/live/restreaming?apikey=[API_KEY]&code=xxxxxxxx&server=2&enable=true&server_url=rtmp://input.com&login=[LOGIN]&password=[PASSWORD]
```

Пример ответа:

```xml
<Response>
    <Title>Promo</Title>
    <Code>xxxxxxxx</Code>
    <PublishKey>xxxxxxxx</PublishKey>
    <EncoderLink>
        https://boomstream.com/api/live/encoder?hash=xxxxxxxxxxxxxxxxx&code=xxxxxxxx
    </EncoderLink>
    <OnlineStatus>True</OnlineStatus>
    <RecordStatus>True</RecordStatus>
    <Concurrent>10</Concurrent>
    <CreationDate>2015-01-29 15:05:58</CreationDate>
    <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; height=&quot;{{height}}&quot;
src=&quot;https://boomstream.com/player.html?code=xxxxxxxx&quot; frameborder=&quot;0&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;</PlayerCode>
    <Poster>
        <Code>xxxxxxxx-m3</Code>
        <Width>1920</Width>
        <Height>1080</Height>
        <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
    </Poster>
    <Screenshots>
        <Item>
            <Code>xxxxxxxx-m3</Code>
            <Width>1920</Width>
            <Height>1080</Height>
            <Url>https://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
        </Item>
    </Screenshots>
    <Status>Success</Status>
</Response>
```
