Jericho / ZoomNet

.NET client library for the Zoom.us REST API v2
MIT License
69 stars 45 forks source link

Meeting ID - long or a string? Discrepancies in GetMeetingParticipantsAsync and GetAsync #318

Closed xantari closed 9 months ago

xantari commented 9 months ago

There seems to be a mix of data types to define a "meetingId" in this package. In most cases it is a long/int64:

long zoomMeetingNumber = "1234656";
var connectionInfo = OAuthConnectionInfo.ForServerToServer(AppSettings.ZoomClientId, AppSettings.ZoomClientSecret, AppSettings.ZoomAccountId);
var client = new ZoomClient(connectionInfo);
var zoomMeeting = await client.Meetings.GetAsync(zoomMeetingNumber) as ScheduledMeeting;

But in this example it is a string:

string zoomMeetingNumber = "1234656";
var connectionInfo = OAuthConnectionInfo.ForServerToServer(AppSettings.ZoomClientId, AppSettings.ZoomClientSecret, AppSettings.ZoomAccountId);
var client = new ZoomClient(connectionInfo);
var participantReport = client.Reports.GetMeetingParticipantsAsync(zoomMeetingNumber);

Should the "meetingId" (zoomMeetingNumber above) be a string everywhere or a long?

Jericho commented 9 months ago

Should the "meetingId" be a string everywhere or a long?

The answer to your question is not as straight forward as you would think!

There are two scenarios you must consider: what is the data type of the meeting Id returned by the Zoom API and what is the data type accepted the Zoom API when you must specify a meeting id in your request. Your question is specifically about the second scenario.

Regarding the first scenario: the Zoom documentation is not clear about this. There are examples where it says that the meeting Id returned from the API is a string and sometimes it says it's a number. In my personal experience, I have observed that the API generally returns the meeting Id as a number but I have also seen a few instances where the numerical meeting id is returned between quotes and therefore is interpreted as a string when the ZoomNet library parses the JSON in the response. I asked a question on the Zoom developers forum over a year ago to clarify but I never got an answer. Therefore, I made the decision to model the meeting id as a long but I had to add an instruction so the JSON parser would allow both numbers and strings, as you can see here.

To add to the confusion, there is also one situation that I'm aware of where the API returns a JSON node called meeting_id which is documented like this: image which leads you to believe that it should contain the numerical meeting id but in fact in contains a proper string like this:

"meeting_id": "ODfDKShNRqKkXbGD09Sk4A==",

This situation explains why I have modeled the MeetingId on the RecordFile class as a `string (as you can see here).

Regarding the second scenario: there are endpoints in the Zoom API that only accept a numerical value. A good example of that, is when you want to retrieve an existing meeting (documented here). You must provide the numerical meeting id to the Zoom API which is why the Meetings.GetAsync method in ZoomNet has a long meetingId parameter, as you can see here. However, there are other endpoints in the API that accept either the numerical meeting id or the UUID (which is a string) which explain why their corresponding methods in the ZoomNet library have a string meetingId parameter. Reports.GetMeetingParticipantsAsync is one such example.

I realize this is a long winded answer for such a simple question, but I wanted to demonstrate that it's not as simple as it might seem.

Let me know if this answers your question.

xantari commented 9 months ago

Thanks for the very detailed response. Makes sense. Would hope their developers would have responded to you, but I bet they were like "oops, we were not consistent here" and maybe don't want to tackle it as it would mean a breaking API change.