REST API
The REST API is comprehensively documented using Swagger, accessible at https://your.domain.com/api/v1/docs.
Direct Join Entry Point
Upon a successful request, the API response will provide a Meeting Entry Point for the direct join to the room. The authorization for this request is determined by the API_KEY_SECRET
configuration specified in your .env
file.
JavaScript Join example
JavaScript
"use strict";
// npm i node-fetch
try {
// Use dynamic import with await
const { default: fetch } = await import("node-fetch");
const API_KEY = "mirotalkbro_default_secret";
const MIROTALK_URL = "https://bro.mirotalk.com/api/v1/join";
const response = await fetch(MIROTALK_URL, {
method: "POST",
headers: {
authorization: API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
room: "test",
}),
});
const data = await response.json();
if (data.error) {
console.log("Error:", data.error);
} else {
console.log("join:", data.join);
}
} catch (error) {
console.error("Error fetching data:", error);
}
PHP Join example
PHP
<?php
$API_KEY_SECRET = "mirotalkbro_default_secret";
$MIROTALK_URL = "https://bro.mirotalk.com/api/v1/join";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $MIROTALK_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = [
'authorization:' . $API_KEY_SECRET,
'Content-Type: application/json'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = array(
"room" => "test"
);
$data_string = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Status code: $httpcode \n";
$data = json_decode($response);
print_r($data);
Python Join example
Python
# pip3 install requests
import requests
import json
API_KEY_SECRET = "mirotalkbro_default_secret"
MIROTALK_URL = "https://bro.mirotalk.com/api/v1/join"
headers = {
"authorization": API_KEY_SECRET,
"Content-Type": "application/json",
}
data = {
"room": "test"
}
response = requests.post(
MIROTALK_URL,
headers=headers,
json=data,
)
print("Status code:", response.status_code)
data = json.loads(response.text)
print("join:", data["join"])
Bash Join example
Bash
#!/bin/bash
API_KEY_SECRET="mirotalkbro_default_secret"
MIROTALK_URL="https://bro.mirotalk.com/api/v1/join"
curl $MIROTALK_URL \
--header "authorization: $API_KEY_SECRET" \
--header "Content-Type: application/json" \
--data '{"room":"test"}' \
--request POST
Note
Replace bro.mirotalk.com
in the code snippets with your.domain.com
.