Overview
Base URL
ALl requests are sent to https://api.agora.io/
.
Authentication
-
HTTP Basic Authentication
Every time you send an HTTP request, you must pass in a credential in the
Authorization
field in the HTTP request header. See RESTful Authentication on how to generate it.Basic authentication is a simple authentication scheme built into the HTTP protocol. To use it, send your HTTP requests with an
Authorization
header that contains the word Basic followed by a space and a base64-encoded stringusername:password
.Example:
Authorization: Basic ZGVtbzpwQDU1dzByZA==
-
HTTP HMAC Authentication
Every time you send an HTTP request, you must pass in an API key in the
Authorization
field in the HTTP request header. See RESTful Authentication on how to generate it.Example:
Authorization: 123
RESTful API overview
Media Gateway can push media streams to Agora SD-RTN™ using standard push protocols (RTMP and SRT), and then publish them to the corresponding channels as the host. Media Gateway includes the following sets of APIs:
-
Streaming key API
Before pushing streams, you need to create a streaming key to ensure that the media stream is pushed to the correct channel and under the correct host UID. This set of RESTful APIs allows you to create, query, and delete streaming keys.
-
Flow configuration template API
When using Media Gateway to push streams into a channel, you can control the pre-processing of the stream with a flow configuration template. For example, enable audio or video transcoding and set transcoding parameters. You can also create a global configuration template for an app ID or a particular streaming key. This set of RESTful APIs allows you to create, query, and delete flow configuration templates.
-
Streaming information API
This set of RESTful APIs allows you to query the list of streams being pushed under the specified app ID, including the domain name used, the streaming key, and the basic parameters of the audio and video streams (resolution, bit rate, number of channels, sampling rate, GOP, and other information). You can also forcefully disconnect the pushed stream.
Make sure that the channel profile is set to live broadcasting, not communication. Otherwise, Media Gateway will fail. See channel profile for details.
To let you monitor the status of Media Gateway, Agora provides the Notifications service. After activating Notifications, you can receive relevant event callbacks using webhooks. Because frequently updates the IP address of the Notifications server, you need to regularly query its IP address and update your firewall whitelist configuration.
In case of problems, refer to Integration best practice to check whether the settings and restrictions have been handled correctly.
To explore the RESTful API parameters, obtain sample code in various client languages, or test Media Gateway requests, refer to the Postman API reference.