Admin API
Moth provides admin APIs for server management and control tasks. They are used to change configuration and perform monitoring.
Admin API overview
Moth admin APIs are intended for administrators and support configuration lookup, update, deletion, state control, and monitoring. They are available over HTTP and WebSocket.
Protocol
http | https: use HTTP/HTTPS when calling the API over HTTPws | wss: use WebSocket or secure WebSocket when calling the API over WebSocket
API types
Moth admin APIs are divided into two groups.
| API | Function | Supported version |
|---|---|---|
/manager | Management operations such as lookup, update, delete, and run control | |
/monitor | Media-client or simple monitoring functions |
Pathnames
The admin API pathnames are as follows.
| API type | Function | Supported version |
|---|---|---|
/manager/http/cmd | Used when calling over HTTP | |
/manager/ws/cmd | Used when calling over WebSocket |
Options
Configure the following options when calling the admin API.
| Option | Description | Usage |
|---|---|---|
| op | Specifies the command to execute. op=[show | set | run | add | delete | update | load | save | ping ] | |
| obj | Specifies the command target. obj=[session | channel | group | config] | |
| id | Specifies the target ID, typically in <xid> format. | |
| state | Specifies the state to apply to the target. state=[idle | using] | |
| opt | Specifies a detailed option for the target. [source | track | key | record | trans] | |
| value | Specifies an additional value. value=[ <number> | on | off] | |
| format | Specifies the output format. format=[text | json] |
Authorization
Moth provides two authorization methods.
- channel usage authorization
- server administration authorization
To authorize channel usage, set a Stream key when using the API. To use server administration functions, authorization is checked against the key configured in the Moth server.
Examples are shown below.
-
channel usage authorization
/manager/http/cmd?format=json&obj=channel&op=set&key=<string> -
server administration authorization
/manager/http/cmd?format=json&obj=channel&op=show&key=<string>
Summary
Use the Moth service API and admin API together to implement media services and manage the server. The service API handles data transfer, while the admin API handles configuration and operations.