Acquire Resource - Beta API
This API lets you acquire resource by passing type, mode, quality, webhookUrl and units as body parameters.
Resource States:
- pending: The resource enters the pending state when you request to acquire it.
- idle: When a resource is ready for use, it enters an ideal state. You will receive a webhook when it enters this state for the first time.
- composing: When you initiate recording, HLS, or RTMP in the resource, it enters the composing state. Upon completion of recording, HLS, or RTMP, it returns to the idle state.
- released: The resource enters to the released state when a you requests to release it. You can not use this resorce for futher use.
HTTP method and endpoint
POST
|
https://api.videosdk.live/v2/resource/acquireHeaders Parameters
REQUIRED
values : YOUR_TOKEN_WITHOUT_ANY_PREFIX
This will be a JWT token generate using VideoSDK ApiKey and Secret.
Note that the token will not include any prefix such as "Basic " or "Bearer ". Just pass a token as value.
You can generate a new token by refering this Guide: Generate Auth token
REQUIRED
values : application/json
This is usefull for json body parameters, so that VideoSDK servers can understand that the incoming body parameter will be a JSON string.
Body Parameters
REQUIRED
Possible values for this field are
recording
, hls
or rtmp
REQUIRED
Webhook URL
OPTIONAL
defaultValue : video-and-audio
Possible values for this field are video-and-audio
or audio
OPTIONAL
defaultValue : med
Possible values for this field are low
, med
or high
OPTIONAL
defaultValue : 1
Number of resources.
POST
|
https://api.videosdk.live/v2/resource/acquire
NodeJS
import fetch from 'node-fetch';
const options = {
method: "POST",
headers: {
"Authorization": "$YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"type" : "recording",
"webhookUrl" : "https://www.example.com/",
"mode" : "video-and-audio",
"quality" : "med",
"units" : "1"
}),
};
const url= `https://api.videosdk.live/v2/resource/acquire`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
RESPONSE
{
"success": true,
"data": [
{
"id": "abcdef9879288c1f48339f64",
"status": "pending",
"type": "recording",
"mode": "video-and-audio",
"quality": "med",
"composerIds": [],
"webhookUrl": "https://example.com/"
}
]
}
Got a Question? Ask us on discord