Rest API - Introduction
In Metered we provide the REST APIs to perform all the functions that can be done from the dashboard and more.
Explore all the available API through the sidebar.
Pre-requisite
To use the Metered REST API you need to have an account, if you don't already have an account you can easily signup for a free account from here: https://dashboard.metered.ca/signup
Acquiring the Secret Key
You will need the Secret Key to authenticate with the API, the Secret Key can be found under the Developers tab on the dashboard.
secret key
Once you have obtained the Secret Key we can use it to call the REST API.
Secret Key should never be exposed in the Front End and must always be used by your back-end server-side application.
Calling the REST API
To call REST API you would have to send the request to your metered domain.
Here is an example cURL request to Create A Room:
- cURL
- Response
curl --request POST \
--url https://yourappname.metered.live/api/v1/api/v1/token \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"globalToken":true}'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Imdsb2JhbFRva2VuIjp0cnVlLCJhcHBOYW1lIjoiaHlwcmhvc3QifSwiaWF0IjoxNjI3NzcwNDI2fQ.mVkFCexiE9UFHN8ujvsEVmXLllu2dXmF--4PzBFYjDY"}
You will receive the following response:
{
"privacy": "public",
"deleteOnExp": false,
"autoJoin": false,
"enableRequestToJoin": true,
"enableChat": true,
"enableScreenSharing": true,
"joinVideoOn": true,
"joinAudioOn": true,
"ownerOnlyBroadcast": false,
"enableRecording": false,
"ejectAtRoomExp": false,
"lang": "en",
"archived": false,
"_id": "6113f3901baf459debe6a33b",
"roomName": "myroom",
"app": "61017571c22d9d49b56f6996",
"created": "2021-08-11T15:58:08.559Z",
}