POST API to Create Real-Time Live streaming Room
POST
    https://<appname>.metered.live/api/v1/realtimelivestreaming/room
<appname> - replace it the name of your app.
info
You need to have Real-Time Live Streaming enabled in your account. To enable go to https://dashboard.metered.ca -> Live streaming
Description
This endpoint allows you to create a Live streaming 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 | - | 
| enableLiveStreaming | boolean | When enabled, livestreaming via HLS will be enabled. You will get a HLS URL for the meeting | no | true | 
| displayMessage | string | Message to display when livestream is not running | no | |
| customCSS | string | Custom CSS to customize the viewer | no | |
| enableRecording | boolean | When enabled livesteam will be recorder | no | |
| recordComposition | boolean | When enabled audio+video will be recorded in a single video stream | no | |
| enableRTMPOut | boolean | Enable RTMP Out to 3rd party services | no | |
| rtmpOutURL | string | URL of 3rd party livestreaming service like YouTube Live | no | 
Request Samples
- cURL
- NodeJs
- Ruby
- Python
- Go
cURL
curl --request POST \
--url 'https://appname.metered.live/api/v1/realtimelivestreaming/room?secretKey={replace_this_with_your_secretKey}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
  {
      "roomName": "mystreamingroom"
  }
  '
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/realtimelivestreaming/room',
            data: {
                "roomName": "mystreamingroom"
            },
            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/realtimelivestreaming/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 = "{\"roomName\":\"mystreamingroom\"}"
response = http.request(request)
puts response.read_body
Python
import requests
url = "https://yourapp.metered.live/api/v1/realtimelivestreaming/room"
payload = {
    "roomName": "mystreamingroom"
}
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": "mystreamingroom"
            }
            `)
    req, err := http.NewRequest("POST", "https://appname.metered.live/api/v1/realtimelivestreaming/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
{
    "viewerURL": "https://livestreamingdemo.metered.live/62d81eff8196a70d5d29538e/player",
    "broadcastManager": "https://dashboard.metered.ca/livestreaming-rooms/62d81eff8196a70d5d29538e/app/62b5d44bd00c04354f16af71/broadcast",
    "roomName": "mystreamingroom",
    "currentlyBroadcasting": false,
    "created": "2022-07-20T15:27:59.002Z",
    "_id": "62d81eff8196a70d5d29538e"
}
400
{ 
    "success": false, 
    "message": "Invalid request"
}