Gianni,
Thank you for your assistance.
Below is C# console-app code to reproduce my problem, followed by the output. As you can see, the call to /roles returns JSON; while the call to /users returns nothing.
Thanks,
Matt
Code
using Microsoft.IdentityModel.Tokens;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Net;
using System.Text;
namespace ZoomUsers
{ // ZoomUsers
class Program
{ // Program
static void GetData(string path)
{ // GetData
const string apiKey = "REDACTED";
const string apiSecret = "REDACTED";
string apiUrl = "https://api.zoom.us/v2/" + path;
Console.WriteLine("Url: " + apiUrl);
DateTime ZoomApiAuthorizationTokenExpiration = DateTime.UtcNow.AddSeconds(30);
JwtSecurityTokenHandler tokenHandler = new JwtSecurityTokenHandler();
string zoomApiAuthorizationToken =
tokenHandler.WriteToken(
tokenHandler.CreateToken(
new SecurityTokenDescriptor
{
Issuer = apiKey
, Expires = ZoomApiAuthorizationTokenExpiration
, SigningCredentials = new SigningCredentials(
new SymmetricSecurityKey(Encoding.ASCII.GetBytes(apiSecret))
, SecurityAlgorithms.HmacSha256
)
}));
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl);
webRequest.Method = "GET";
webRequest.Headers.Add("Authorization", "Bearer " + zoomApiAuthorizationToken);
IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null);
asyncResult.AsyncWaitHandle.WaitOne();
using (HttpWebResponse webResponse = (HttpWebResponse)(webRequest.EndGetResponse(asyncResult)))
{ // using webResponse
Console.WriteLine("StatusCode: " + webResponse.StatusCode.ToString());
Console.WriteLine("ContentLength: " + webResponse.ContentLength.ToString());
if (webResponse.ContentLength > 0)
{ // get response body
using (StreamReader reader = new StreamReader(webResponse.GetResponseStream()))
{ // using reader
Console.WriteLine("Response: " + reader.ReadToEnd());
} // using reader
} // get response body
} // using webResponse
Console.WriteLine();
} // GetData
static void Main(string[] args)
{ // Main
GetData("roles");
GetData("users");
} // Main
} // Program
} // ZoomUsers
Output
Url: https://api.zoom.us/v2/roles
StatusCode: OK
ContentLength: 1117
Response: {"total_records":9,"roles":[{"id":"0","name":"Owner","description":"Account owner has full privileges to acces
s and manage a Zoom account.","total_members":1},{"id":"1","name":"Admin","description":"Admins have wide range privileg
es to access and manage a Zoom account.","total_members":6},{"id":"2","name":"Member","description":"Members have access
to basic Zoom video meeting functions but no account management privileges.","total_members":7898},{"id":"REDACTED","name":"Video Admin","description":"Can edit Videos","total_members":9},{"id":"REDACTED","nam
e":"Report Admin","description":"Access to all Reporting","total_members":2},{"id":"REDACTED","name":"Bil
ling Admin","description":"Access to Billing Info","total_members":1},{"id":"REDACTED","name":"User Admin
","description":"Access for User Support","total_members":5},{"id":"REDACTED","name":"Security Admin","de
scription":"Manage SSO/SAML","total_members":5},{"id":"REDACTED","name":"Developer","description":"Access
for Zoom API Development","total_members":1}]}
Url: https://api.zoom.us/v2/users
StatusCode: OK
ContentLength: -1