Receivers API
A receiver is an input stream: a UDP multicast, an HTTP or HLS source, or an RTSP camera. A channel takes its video from a receiver. Read more about the supported sources in Receivers.
Receiver Object
Section titled “Receiver Object”{ "id": "news-source", "enable": true, "name": "News source", "source": "udp://239.1.1.1:1234", "user_agent": "Alta"}- id: Receiver ID. Only in the create request. If you omit it, Alta generates a UUID.
- enable: Starts the receiver.
- name: Name of the receiver. If you omit it in the create request, Alta uses the ID.
- source: URL of the input stream.
- user_agent (optional):
User-Agentheader for HTTP sources.
Create a Receiver
Section titled “Create a Receiver”POST /api/ott/receiverExample:
curl -sS -X POST -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ 'http://alta.example.com:8100/api/ott/receiver' \ -d '{"id": "news-source", "name": "News source", "source": "udp://239.1.1.1:1234", "enable": true}'Returns 204, or 409 if a receiver with this ID already exists.
Get a Receiver
Section titled “Get a Receiver”GET /api/ott/receiver?id=<receiver_id>Returns the receiver object without the id field, or 404. Available to admin and observer.
Update a Receiver
Section titled “Update a Receiver”PUT /api/ott/receiver?id=<receiver_id>Send all fields: enable, name, source, and user_agent. A field you omit is cleared. An omitted enable disables the receiver.
curl -sS -X PUT -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ 'http://alta.example.com:8100/api/ott/receiver?id=news-source' \ -d '{"enable": true, "name": "News source", "source": "udp://239.1.1.2:1234"}'When the source, name, or enable changes, Alta restarts the receiver and the channels that use it. If a channel cannot start, the answer is 200 with an object where the value is the reason:
{ "-": "reason of the error" }Disabling a receiver also disables the channels that use it.
Delete a Receiver
Section titled “Delete a Receiver”DELETE /api/ott/receiver?id=<receiver_id>Stops the channels that use the receiver, then removes it. The channels stay in the configuration and are disabled. Before you enable them again, set another receiver with Update a Channel. Returns 204, or 404.
Receiver Status
Section titled “Receiver Status”GET /api/ott/receiver/statusReturns the traffic of all receivers by ID. Use it to get the list of receiver IDs. Available to admin and observer.
Response:
{ "receivers": { "news-source": { "totalBytes": "1.5 GB", "speed": "4.2 Mbit/s" } }}- totalBytes: Received data since the start, as text for display.
- speed: Current speed, as text for display.
Import from M3U
Section titled “Import from M3U”Alta can create receivers and channels from an M3U playlist. The import has two steps: read the playlist, then import the items you select.
1. Read a playlist from a URL:
GET /api/ott/receiver/importm3u?id=<playlist_url>Alta downloads the URL from the server, not from your computer. The server must reach the address. Returns 422 if the download fails.
To read a playlist from your own file, send it as a Base64 string in the JSON body of a POST request to /api/ott/receiver/importm3u.
curl -sS -X POST -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ 'http://alta.example.com:8100/api/ott/receiver/importm3u' \ -d "\"$(base64 < playlist.m3u | tr -d '\n')\""Response:
[ { "id": "1", "name": "News", "channel_path": "news", "address": "udp://239.1.1.1:1234" }]2. Import the selected items:
PUT /api/ott/receiver/importm3uThe body is an object with the items to import, in the same format. Each item needs the address and the channel_path.
curl -sS -X PUT -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ 'http://alta.example.com:8100/api/ott/receiver/importm3u' \ -d '{"1": {"id": "1", "name": "News", "channel_path": "news", "address": "udp://239.1.1.1:1234"}}'For each item, Alta creates a disabled receiver and the channel <channel_path>/main. Enable them with Update a Receiver and Start and Stop.
| Code | Description |
|---|---|
204 | All items are imported |
200 | Some items are skipped. The body groups them by the reason: the channel already exists, or a receiver with this source already exists |
400 | An item has no address or no channel path |
413 | More than 256 items |