POST API to Create Meeting Room
POST
https://<appname>.metered.live/api/v1/room
<appname>
- replace it the name of your app.
Description
This endpoint allows you to create a Meeting Room
Parameters
Parameters | Description | Required | Options | |
---|---|---|---|---|
Query | ||||
secretKey | string | your secret key | yes | - |
Body | application/json | |||
roomName | string | If not specified the room name will be auto-generated. Name should be URL friendly, do not put any spaces in the name. | no | - |
privacy | string | Privacy setting for the room. Public rooms can be joined by anyone, private rooms required auth token to join | yes | public | private |
expireUnixSec | integer | unix timestamp in seconds to specify the expiry of the room. Users cannot join after expiry | no | - |
ejectAtRoomExp | boolean | Eject all the participants in the room when expireUnixSec is reached | no | - |
notBeforeUnixSec | integer | Unix timestamp in seconds. Users cannot join the before this time. | no | - |
maxParticipants | integer | Limit the maximum number of participants that can join the room | no | - |
autoJoin | boolean | Enable auto join | no | false | true |
showInviteBox | boolean | iframe only option. Show the invite box in the meeting room when no participants are there in the meeting. default true | no | true | true |
enableRequestToJoin | boolean | Enable public users to request to join a private meeting. A request will be sent to the meeting admin, and when approved the user can join | no | false | true |
enableChat | boolean | iframe only option. Enable chat messages | no | false | true |
newChatForMeetingSession | boolean | iframe only option. Create a new chat room for each meeting session, if set to false chat history will persist during multiple calls. default true | no | |
enableScreenSharing | boolean | iframe only option. Allow users to do screen sharing | no | false | true |
joinVideoOn | boolean | iframe only option. When user joins the meeting the camera will be default on | no | false | true |
joinAudioOn | boolean | iframe only option. When the user joins the meeting the microphone will be default on | no | false | true |
enableRecording | boolean | Users can record Meeting | no | false | true |
ownerOnlyBroadcast | boolean | default false . Only admin can share camera, mic, and screen. | no | false | true |
recordRoom | boolean | Automatically record the meeting | ||
ejectAfterElapsedTimeInSec | integer | Eject user after certain time from the meeting. For e.g in your application you want remove the user to be active for max 2hrs then you can set this value to 7200 (2hrs in seconds). It is a good idea to set this value to prevent people from keeping the session on for extremely long times. | no | - |
meetingJoinWebhook | string | When a user joins the room, a webhook will be sent to the specified url | no | - |
meetingLeftWebhook | string | Webhook is trigged when participant leaves the meeting. | ||
meetingStartedWebhook | string | Webhook is trigged when a meeting session is created. | ||
meetingEndedWebhook | string | Webhook is trigged when a meeting is ends. | ||
endMeetingAfterNoActivityInSec | integer | Time is seconds, End the meeting automatically if no one in the meeting is sharing their microphone, camera or screen. Suppose if you want to end the meeting after 5 mins if no one is sharing any device, the you would set the value of this property to 300 (5 mins in seconds) | no | - |
audioOnlyRoom | boolean | When set to true, only audio/microphone can be shared in this room, and audio only pricing will be applied. | no | false | true |
enableComposition | boolean | Composition will be enabled. Composition has to be enabled for recording a composed meeting, for livestreaming and RTMP out. | no | true | false |
compositionLayout | enum | Set the layout of the composition | no | grid | active_speaker |
recordComposition | boolean | When enable composition will be recorded | no | true | false |
enableRTMPOut | boolean | When enable meeting will be stream to 3rd party service like Youtube Live, Facebook Live, Twitch etc. | no | true | false |
rtmpOutURL | string | URL for the 3rd Party RTMP Service. For more details refer this guide: https://www.metered.ca/docs/RTMP-OUT/Streaming-The-Meeting-To-Youtube-Live | When rtmpOut is enable then this become required | |
enableLiveStreaming | boolean | When enabled, livestreaming via HLS will be enabled. You will get a HLS URL for the meeting | no | true |
Request Samples
- cURL
- NodeJs
- Ruby
- Python
- Go
cURL
curl --request POST \
--url 'https://appname.metered.live/api/v1/room?secretKey={replace_this_with_your_secretKey}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"roomName": "string",
"privacy": "public",
"expireUnixSec": 0,
"ejectAtRoomExp": false,
"notBeforeUnixSec": 0,
"maxParticipants": 0,
"autoJoin": true,
"enableRequestToJoin": true,
"enableChat": true,
"enableScreenSharing": true,
"joinVideoOn": false,
"joinAudioOn": false,
"recordRoom": true,
"ejectAfterElapsedTimeInSec": 0,
"meetingJoinWebhook": "string",
"endMeetingAfterNoActivityInSec": 0,
"audioOnlyRoom": false
}
'
NodeJs (Axios)
//We are using axios to send requests in our example
const axios = require('axios');
async function (){
try{
const response = await axios({
method: 'post',
url: 'https://appname.metered.live/api/v1/room',
data: {
roomName: 'demo_room',
privacy: 'private',
expireUnixSec: 7832947982,
ejectAtRoomExp: true,
maxParticipants: 4,
autoJoin: true,
enableRequestToJoin: true,
recordRoom: true,
deleteOnExp: true,
ejectAfterElapsedTimeInSec: 7200
},
params: {
secretKey: 'your_secret_key'
},
})
console.log(response)
} catch(error){
console.log(error)
}
}
Ruby
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://yourapp.metered.live/api/v1/room")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request.body = "{\"privacy\":\"public\",\"ejectAtRoomExp\":false,\"enableRequestToJoin\":true,\"enableChat\":true,\"enableScreenSharing\":true,\"joinVideoOn\":false,\"joinAudioOn\":false,\"enableRecording\":false,\"audioOnlyRoom\":false}"
response = http.request(request)
puts response.read_body
Python
import requests
url = "https://yourapp.metered.live/api/v1/room"
payload = {
"privacy": "public",
"ejectAtRoomExp": False,
"enableRequestToJoin": True,
"enableChat": True,
"enableScreenSharing": True,
"joinVideoOn": False,
"joinAudioOn": False,
"recordRoom": False,
"audioOnlyRoom": False
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
Go
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`
{
"roomName": "string",
"privacy": "public",
"expireUnixSec": 0,
"ejectAtRoomExp": false,
"notBeforeUnixSec": 0,
"maxParticipants": 0,
"autoJoin": true,
"enableRequestToJoin": true,
"enableChat": true,
"enableScreenSharing": true,
"joinVideoOn": false,
"joinAudioOn": false,
"recordRoom": false,
"ejectAfterElapsedTimeInSec": 0,
"meetingJoinWebhook": "string",
"endMeetingAfterNoActivityInSec": 0,
"audioOnlyRoom": false
}
`)
req, err := http.NewRequest("POST", "https://appname.metered.live/api/v1/room?secretKey={replace_this_with_your_secretKey}", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
Responses
200
{
"privacy": "public",
"deleteOnExp": false,
"autoJoin": false,
"enableRequestToJoin": false,
"enableChat": false,
"enableScreenSharing": true,
"joinVideoOn": true,
"joinAudioOn": true,
"ownerOnlyBroadcast": false,
"recordRoom": false,
"ejectAtRoomExp": false,
"lang": "en",
"archived": false,
"_id": "61005784c3c9104421af1534",
"roomName": "6kpYYvYj75",
"app": "61005767f41008463845bac0",
"created": "2021-07-27T18:59:16.448Z",
"__v": 0
}
400
{
"success": false,
"message": "Invalid request"
}