HTTP API
Alta has an HTTP API with JSON requests and responses. Use it to create channels, connect input streams, manage archive storages and access control, and read the state of the service from your billing system, middleware, or scripts.
The Alta web interface uses the same API, so everything you can do in the interface you can automate.
Base URL
Section titled “Base URL”All requests go to the API Server, not to the OTT Server that serves viewers. The default port is 8100. Read more in HTTP Server.
http://alta.example.com:8100/api/...Authentication
Section titled “Authentication”Every request, except /api/login, needs the credentials of an Alta user. There are two ways:
- Bearer token: get a token with
POST /api/loginand send it in theAuthorization: Bearer <token>header. - HTTP Basic: send the login and the password of the user in every request.
Read more in Quick Start.
The role of the user decides what the API allows. Roles are set in Users.
| Role | Access |
|---|---|
admin | All requests of this section |
observer | Read-only: Status, receivers (GET, status), channel storage, previews and M3U export |
anonymous | No access. Every request returns 401 |
Any signed-in user can read their own options and change their own password. See Users.
Requests and Responses
Section titled “Requests and Responses”- Send JSON bodies with the
Content-Type: application/jsonheader. - A request for a single item uses the
idquery parameter, for example/api/ott/receiver?id=news-hd. - Channel and variant IDs contain a slash, for example
discovery/hd. Send the slash as is or URL-encoded as%2F. POSTcreates an item,PUTreplaces it,DELETEremoves it. APUTrequest replaces all fields of the item. Send the complete object, not only the changed fields.- A successful request that changes data returns
204 No Contentwith an empty body. Alta saves the configuration before it answers. - Alta has no requests that list channels, receivers, or storages. To get the IDs of the items, use the status requests, for example receiver status, storage status, and session status.
Response Codes
Section titled “Response Codes”| Code | Description |
|---|---|
200 | Success with a body |
204 | Success, or the item has nothing to return, for example a channel without a storage |
400 | The id parameter is missing, or the request is invalid. The body can contain a reason as plain text |
401 | No credentials, or the credentials are wrong |
403 | The role of the user does not allow the request. Wrong login or password for /api/login |
404 | The item does not exist |
409 | The item already exists, or a receiver is already used by another channel |
422 | A field value is not valid |
500 | Alta could not save the configuration |
Resources
Section titled “Resources”| Section | What you can do |
|---|---|
| Quick Start | Log in and publish the first channel |
| Status | Read the version, uptime, CPU, memory, and disk space |
| Channels | Create, change, start, stop, and delete channels, and export M3U playlists |
| Receivers | Manage input streams and import channels from an M3U playlist |
| Storages | Manage archive storages and read their size |
| Preview API | Download MP4 preview clips from the archive |
| Authorizers | Manage access rules and generate Securetoken values |
| Sessions | See who watches now |
| HLS Access | Change segment duration and playlist size |
| Users | Manage users and passwords |