Don't work to Retrieve the Zoom Rooms ID and name with Zoom Rooms API

Using this template helps us debug your issues more effectively :slight_smile:

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.

Hey @vinowang,

Thank you for reaching out to the Zoom Developer Forum. From what I can tell, you’re making this call successfully. The only potential issue I’m seeing is that you are including the zr_name parameter in your call to the API.

I would first make sure that you have a Zoom Room with that name. You can also try removing the parameter from the request to see all Zoom Rooms to make sure that you are requesting the right one.

{
  "jsonrpc": "2.0",
  "method": "list"
}

Let me know if that helps. :slightly_smiling_face:

Thanks,
Max

1 Like

Hi MaxM,

Thank you for your reply, I only POST the parameter as below:

sTemp = “{“jsonrpc”: “2.0”,“method”:“list”}”;

but still no data return. Could you help me double check?

Hey @vinowang,

Thank you for the update. When I looked at your account, I could see that there is a device but currently there are no Zoom Rooms created. You can confirm this by navigating here:

Is the email that you’re using for the developer forum the same as the Zoom account you’re testing this with? If so, make sure that you’ve configured the Zoom Room completely and try calling this API again.

Let me know if that helps.

Thanks,
Max

Hi Max,

It’s normal now. Thank you for your help .

Vino

Thanks for confirming—Glad Max was able to help you.

Best,
Will

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.