Skip to main content

Using the REST APIs

In this guide you will learn how to use the REST APIs

In Metered we provide the REST APIs to perform all the functions that can be done from the dashboard and more.

To view the complete REST API documentation click here.

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

After you have created an account come back here for the next steps. If you have not read the Advanced SDK Guide. we highly recommend that you read it first as it will introduce you to important concepts.

1. Know your Metered Domain​

Your metered domain is your appname.metered.live where appname is the name of your app that you have created during signup.

Suppose during signup you have named your app simpleapp then your metered domain will be simpleapp.metered.live

Two dashboards

Screenshots below show the new dashboard. If you use the classic dashboard, pick the Classic dashboard tab — your choice is remembered on every page. You can switch at any time: Old dashboard in the header takes you back to the classic dashboard, and dashboard.metered.ca/v2 opens the new one. What changed in the new dashboard →

Your app name is shown in the Workspace switcher at the top of the left navigation, and the full domain is shown as Metered domain on the Developers page.

Workspace switcher in the new dashboard Your app name in the Workspace switcher

2. Acquiring the Secret Key​

You will need the Secret Key to authenticate with the API. Open dashboard.metered.ca/v2, pick your app in the Workspace switcher and go to Developers. The page shows your Metered domain and your secret key. The secret key is hidden — click Reveal to show it, or the copy button to copy it.

Developers page with the Metered domain and secret key secret key

Once you have obtained the Secret Key we can use it to call the REST API.

Never Expose your Secret Key to the Front End

Secret Key should never be exposed in the Front End and must always be used by your back-end server-side application.

3. Calling the REST API​

To call REST API you would have to send the request to your metered domain, and we have learned how to obtain that in the first step, and sending the secretKey as query parameter.

Here is an example cURL request to Create A Room:

cURL
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}'

You will receive the following response:

JSON

{
"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",
}

4. Explore the Complete REST API​

You can find the complete REST API documentation here and explore all the methods that available that you can integrate into your application to create rich experiences for your users.

Conclusion​

In the above document, we have described how you can get started with using the REST API, there is a lot more to explore:

If you have any questions or need any help with the integration feel free to contact us via phone or email.