Skip to main content
Skip table of contents

General description of Mediaserver API

API Reference

API is a set of functions that helps to understand how to interact with a program. It includes:

  • Operations that can be performed

  • Data that is input

  • Data that is output (content data or error message)

VSaaS product API is organized based on REST.

REST API is responsible for almost all interactions between server and client applications (server application provides access to its data to the client application via a specific URL).

The Mediaserver product API has predictable URLs, resource-oriented, returns responses in JSON format, uses standard HTTP response codes, and authentication.

All requests must have a header: Content-Type: application/json

This is necessary for the backend to understand whether the client supports responses in the JSON format. If this header is not present, errors will be returned with an HTML page.

Authentication

Authentication of a request is necessary to perform API requests. Authentication is done through a token (hereafter referred to as the API Access Token), which must be obtained through a special API request only from localhost (from the server console on which Mediaserver is installed).

An example of such a request

CODE
curl -k --request POST 'https://127.0.0.1:8080/api/auth/token/api/ \
--header 'Content-Type: application/json' \
--data-raw '{
    "client": "client-unique-id",
    "duration": 3600
}'
  • client, a unique client identifier used for logging and access control

  • duration, the token's lifetime in seconds. You can specify a value of 0, in which case the token will have an unlimited lifetime

Compromising or transferring the token to third parties may result in the loss of your data and unstable service operation.

After successfully obtaining the API Access Token, all subsequent requests must be made with the transmission of this token either through the HTTP header or as a URL request parameter.

Example

Authorization: k237RLwFGY1Ptidjj0haOvF75lxdxR7x7XZKKN97AqtJtuSqUdDIntEmPzjYZXxG

or

CODE
curl -k --request POST 'https://mediaserver:8080/api/auth/token/access/?token=k237RLwFGY1Ptidjj0haOvF75lxdxR7x7XZKKN97AqtJtuSqUdDIntEmPzjYZXxG' \
--header 'Content-Type: application/json' \
--data-raw '{
    "uid": "stream-uid",
    "user": "user-unique-id",
    "duration": 3600
}'

Requests that require authentication but have not been provided with a token or have an incorrect token will result in an error with a status of 401.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.