Using this template helps us debug your issues more effectively
Description
Don’t work to Retrieve the Zoom Rooms ID and name with Zoom Rooms API.
Error
no return data. Actually it has two meeting rooms under the account.
{“jsonrpc”:“2.0”,“result”:{“send_at”:“2021-03-09T03:19:08Z”,“data”:},“id”:“d000be66-2c83-4d6c-882c-3424fbee3645”}
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Which Endpoint/s?
List
Retrieve the Zoom Rooms ID and name.
Endpoint:
POST https://api.zoom.us/v2/rooms/zrlist
Request Body Example:
{
"jsonrpc": "2.0",
"method": "list",
"params": {
"zr_name": "My Zoom Room"
}
}
How To Reproduce (If applicable)
using System;
using System.Text;
using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.Tokens;
using RestSharp;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace IntexZoom
{
class Program
{
static void Main(string args)
{
//String sReturn = ZoomToken();
//Console.WriteLine("get token is : " + sReturn);
//GetUserList();
GetRoomsList();
}
private static string ZoomToken()
{
// Token will be good for 30 minutes
DateTime Expiry = DateTime.UtcNow.AddMinutes(30);
string ApiKey = "?????????????";
string ApiSecret = "?????????????????????";
int ts = (int)(Expiry - new DateTime(1970, 1, 1)).TotalSeconds;
// Create Security key using private key above:
var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(ApiSecret));
// length should be >256b
var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
//Finally create a Token
var header = new JwtHeader(credentials);
//Zoom Required Payload
var payload = new JwtPayload
{
{ "iss", ApiKey},
{ "exp", ts },
};
var secToken = new JwtSecurityToken(header, payload);
var handler = new JwtSecurityTokenHandler();
// Token to String so you can use it in your client
var tokenString = handler.WriteToken(secToken);
return tokenString;
}
private static void GetUserList()
{
var client = new RestClient("https://api.zoom.us/v2/users?status=active&page_size=30&page_number=1");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer " + ZoomToken());
IRestResponse response = client.Execute(request);
Console.WriteLine("get response is : " + response.Content);
}
private static void GetRoomsList()
{
var client = new RestClient("https://api.zoom.us/v2/rooms/zrlist");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer " + ZoomToken());
string json = JsonConvert.SerializeObject(GetListMeetingJson(""));
Console.WriteLine("get json is : " + json);
request.AddParameter("application/json", json, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine("get response is : " + response.Content);
}
private static JObject GetListMeetingJson(String sMeetingName)
{
sMeetingName = (null == sMeetingName ? "" : sMeetingName);
var sTemp = "";
if (sMeetingName.Equals(""))
{
sTemp = "{\"jsonrpc\": \"2.0\",\"method\":\"list\"}";
}
else
{
sTemp = "{\"jsonrpc\": \"2.0\",\"method\":\"list\",\"params\":{\"zr_name\":\"" + sMeetingName + "\"}}";
}
var JsonData = JObject.Parse(sTemp);
return JsonData;
}
}
}
Screenshots (If applicable)
Additional context
Add any other context about the problem here.