REST API (Beta)

Overview

The REST APIs provided by OME allow you to query or change settings such as VirtualHost and Application/Stream.
The APIs are currently beta version, so there are some limitations/considerations.
  • Settings of VirtualHost can only be viewed and cannot be changed or deleted.
  • If you add/change/delete the settings of the App/Output Profile by invoking the API, the app will be restarted. This means that all sessions associated with the app will be disconnected.
  • The API version is fixed with v1 until the experimental stage is complete, and the detailed specification can be changed at any time.
By default, OvenMediaEngine's APIs are disabled, so the following settings are required to use the API:

Setting up for using the APIs

Port

Set the <Port> to use by the API server. If you omit <Port>, you will use the API server's default port, port 8081.
1
<Server version="8">
2
...
3
<Bind>
4
<Managers>
5
<API>
6
<Port>8081</Port>
7
<!-- If you need TLS support, please uncomment below:
8
<TLSPort>8082</TLSPort>
9
-->
10
</API>
11
</Managers>
12
...
13
</Bind>
14
...
15
</Server>
Copied!

Host and Permissions

<Host> sets the Host name and TLS certificate information to be used by the API server, and <AccessToken> sets the token to be used for authentication when calling the APIs. You must use this token to invoke the API of OvenMediaEngine.
1
<Server version="8">
2
...
3
<Managers>
4
<Host>
5
<Names>
6
<Name>*</Name>
7
</Names>
8
<!--
9
If you want to set up TLS, set it up by referring to the following:
10
<TLS>
11
<CertPath>airensoft_com.crt</CertPath>
12
<KeyPath>airensoft_com.key</KeyPath>
13
<ChainCertPath>airensoft_com_chain.crt</ChainCertPath>
14
</TLS>
15
-->
16
</Host>
17
<API>
18
<AccessToken>your_access_token</AccessToken>
19
</API>
20
</Managers>
21
</Server>
Copied!

API Request/Response Specification

In this manual, the following format is used when describing the API.
get
http://<OME_HOST>:<API_PORT>
/<VERSION>/<API_PATH>[/...]
<VERSION>/<API_PATH>

<OME_HOST>

This means the IP or domain of the server on which your OME is running.

<API_PORT>

This means the port number of the API you set up in Server.xml. The default value is 8081.

<VERSION>

Indicates the version of the API. Currently, all APIs are v1.

<API_PATH>

Indicates the API path to be called. The API path is usually in the following form:
1
/resource-group[/resource[/resource-group[/resource/...]]][:action]
Copied!
resource means an item, such as VirtualHost or Application, and action is used to command an action to a specific resource, such as push or record.

Response

All response results are provided in the HTTP status code and response body, and if there are multiple response results in the response, the HTTP status code will be 207 MultiStatus. The API response data is in the form of an array of Response or Response as follows:
1
// Single data request example
2
3
// << Request >>
4
// Request URI: GET /v1/vhosts/default
5
// Header:
6
// authorization: Basic b21lLWFjY2Vzcy10b2tlbg==
7
8
// << Response >>
9
// HTTP Status code: 200 OK
10
// Response Body:
11
{
12
"statusCode": 200,
13
"message": "OK",
14
"response": ... // Requested data
15
}
Copied!
1
// Multiple data request (Status codes are the same)
2
3
// << Request >>
4
// Request URI: POST /v1/vhost/default/apps
5
// Header:
6
// authorization: Basic b21lLWFjY2Vzcy10b2tlbg==
7
// Request Body:
8
[
9
{ ... }, // App information to create
10
{ ... }, // App information to create
11
]
12
13
// << Response >>
14
// HTTP Status code: 200 OK
15
// Response Body:
16
[
17
{
18
"statusCode": 200,
19
"message": "OK",
20
"response": ... // App1
21
},
22
{
23
"statusCode": 200,
24
"message": "OK",
25
"response": ... // App2
26
}
27
]
Copied!
1
// Multiple data request (Different status codes)
2
3
// << Request >>
4
// Request URI: POST /v1/vhost/default/apps
5
// Header:
6
// authorization: Basic b21lLWFjY2Vzcy10b2tlbg==
7
// Request Body:
8
[
9
{ ... }, // App information to create
10
{ ... }, // App information to create
11
]
12
13
// << Response >>
14
// HTTP Status code: 207 MultiStatus
15
// Response Body:
16
[
17
{
18
"statusCode": 200,
19
"message": "OK",
20
"response": ... // App1
21
},
22
{
23
"statusCode": 404,
24
"message": "Not found"
25
}
26
]
Copied!
Last modified 25d ago