Getting the current connected participant count incorrect - /metrics/meetings/{meetingId}

It is desired to know the current number of connected participants at any particular time. Currently we are using the api /metrics/meetings/{meetingId}. However the value returned for “participants” does not correlate with the number seen in the Zoom Meeting window. The number in the Zoom Meeting window is always significantly lower. My suspicion is that the “participants” value includes those who have already left the meeting. Can anyone confirm that?

If that is the case, how does on find the current number of connected participants? Using this api /metrics/meetings/{meetingId}/participants seems overkill. That is, download the entire participant list and counting those who has not left the meeting.

Thanks

For anyone interested in a solution (you do have to download the entire participant list), here is a working version in Java.

        String tokenString = token.generateZoomJWT2();
        Assert.assertTrue(token != null);
        String meetingId = environment.getProperty("meeting_id");

        // account needs to be paid account with Dashboard enabled
        // this query will get the current number of participants
        // for the meetingId (Virtual Zoom meeting)
        String url = "https://api.zoom.us/v2/metrics/meetings/" + meetingId + "/participants";
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
        String nextPageToken = "START";
        UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(url);
        uriComponentsBuilder.queryParam("type", "live");
        uriComponentsBuilder.queryParam("page_size", "300");
        uriComponentsBuilder.queryParam("next_page_token", nextPageToken);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Authorization", "Bearer " + tokenString);
        headers.add("content-type", "application/json");
        List<MediaType> accepts = new ArrayList<>();
        accepts.add(MediaType.APPLICATION_JSON);
        headers.setAccept(accepts);
        HttpEntity<?> requestEntity = new HttpEntity<>(headers);
        List<ZoomMeetingParticipantDTO> participants = new ArrayList<>();
        while (nextPageToken != null && nextPageToken.length() > 0) {
            try {
                if (nextPageToken.equals("START")) nextPageToken = "";
                uriComponentsBuilder.replaceQueryParam("next_page_token", nextPageToken);
                ResponseEntity<ZoomMeetingParticipantsDTO> response = restTemplate.exchange(uriComponentsBuilder.toUriString(), HttpMethod.GET, requestEntity, ZoomMeetingParticipantsDTO.class);
                Assert.assertTrue(response != null);
                Assert.assertTrue(response.getBody() != null);
                Assert.assertTrue(response.getBody().getParticipants() != null);
                nextPageToken = response.getBody().getNext_page_token();
                List<ZoomMeetingParticipantDTO> participantsList = response.getBody().getParticipants();
                participants.addAll(participantsList);
            } catch (RestClientException restClientException) {
                System.out.println("restClientException " + restClientException.getMessage());
            }
        }
        System.out.println("total size of list " + participants.size());
        // at this point we should have all the participants in the list
        // filter out the ones who have left the meeting
        long totalCurrentParticipants = participants.stream().filter(zoomMeetingParticipantDTO -> zoomMeetingParticipantDTO.getLeave_time() == null || zoomMeetingParticipantDTO.getLeave_time().length() == 0).count();
        System.out.println("total size of list after removing those who have left " + totalCurrentParticipants);

Hi @mrobinson ,

Thank you for offering the above! The following meeting events could also be helpful for your needs and reduce the number of API calls you’re making:

Gianni

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