Trouble accessing Past Meetings data through API for Zoom business account (using Python)

Description
I’m trying to utilize a Zoom API in order to more easily pull Past Meetings data for my entire organization – of which I am an Admin – and while the code appears to connect to Zoom data, it does not appear to be pulling a complete meeting history. I’ve detailed the Python code below; any guidance you could provide would be much appreciated – if I can get this API working properly, it would open the possibility for expanded use of Zoom by my organization in the future. *s there something I’m missing in my code??

Error
No Error being returned, just an incomplete data set.

Python Code for “Zoom” class
import time
from typing import Optional, Dict, Union, Any
import requests
from authlib.jose import jwt
from requests import Response

class Zoom:
def init(self, api_key: str, api_secret: str):
self.api_key = api_key
self.api_secret = api_secret
self.base_url = “https://api.zoom.us/v2
self.reports_url = f"{self.base_url}/report/meetings"
self.jwt_token_exp = 1800
self.jwt_token_algo = “HS256”

def get_meeting_participants(self, meeting_id: str, jwt_token: bytes,
                             next_page_token: Optional[str] = None) -> Response:
    url: str = f"{self.reports_url}/{meeting_id}/participants"
    query_params: Dict[str, Union[int, str]] = {"page_size": 300}
    if next_page_token:
        query_params.update({"next_page_token": next_page_token})

    r: Response = requests.get(url,
                               headers={"Authorization": f"Bearer {jwt_token.decode('utf-8')}"},
                               params=query_params)

    return r


def get_past_meeting_participants(self, past_meeting_uuid: str, jwt_token: bytes,
                             next_page_token: Optional[str] = None) -> Response:
    url: str = f"{self.reports_url}/past_meetings/{past_meeting_uuid}/participants"
    query_params: Dict[str, Union[int, str]] = {"page_size": 300}
    if next_page_token:
        query_params.update({"next_page_token": next_page_token})

    r: Response = requests.get(url,
                               headers={"Authorization": f"Bearer {jwt_token.decode('utf-8')}"},
                               params=query_params)

    return r



def generate_jwt_token(self) -> bytes:
    iat = int(time.time())

    jwt_payload: Dict[str, Any] = {
        "aud": None,
        "iss": self.api_key,
        "exp": iat + self.jwt_token_exp,
        "iat": iat
    }

    header: Dict[str, str] = {"alg": self.jwt_token_algo}

    jwt_token: bytes = jwt.encode(header, jwt_payload, self.api_secret)

    return jwt_token

Python code for utilizing “Zoom” class to query API
import os
import pandas as pd
from datetime import datetime
import json
from zoomus import ZoomClient
from Web_Services_Zoom_Functions import Zoom

start_date = input("What is the PERIOD START DATE? ")
end_date = input("What is the PERIOD END DATE? ")

client = ZoomClient(‘QdcpJ2IkQNi0lhLk6shDxg’, ‘mNhc7yZkAXQIy9DOd3tIQsFD5xVuCZIfodmo’)
user_list_response = client.user.list()
user_list = json.loads(user_list_response.content)
all_meetings = pd.DataFrame(columns=[‘uuid’, ‘id’,‘host_id’,‘topic’,‘type’,‘start_time’,‘duration’,‘timezone’,‘created_at’,‘join_url’,‘participant_count’,‘department’])
for user in user_list[‘users’]:
user_id = user[‘id’]
x = (json.loads(client.meeting.list(user_id=user_id).content))
if (x[‘total_records’]>0):
meetings = pd.DataFrame.from_dict(x[‘meetings’],dtype=str)
#meetings = meetings[~pd.isna(meetings[‘start_time’])].reset_index().drop(columns=[‘index’])
meetings[‘start_time’] = pd.to_datetime(meetings[‘start_time’].str.slice(0,10))
meetings[‘participant_count’] = None
meetings[‘user’] = ‘’
meetings[‘department’] = ‘’
zoom = Zoom(‘QdcpJ2IkQNi0lhLk6shDxg’, ‘mNhc7yZkAXQIy9DOd3tIQsFD5xVuCZIfodmo’)
jwt_token: bytes = zoom.generate_jwt_token()
for i,row in meetings.iterrows():
response = zoom.get_meeting_participants(meetings[‘id’][i], jwt_token)
list_of_participants = response.json().get(“participants”)
if(list_of_participants is not None):
meetings[‘participant_count’][i] = len(list_of_participants)
meetings[‘user’][i] = (user[‘first_name’] + ’ ’ + user[‘last_name’]).title()
meetings[‘department’][i] = user[‘dept’]
all_meetings = all_meetings.append(meetings)
all_meetings = all_meetings.reset_index().drop(columns=[‘index’])

Hi @nerkes,

When you say that the API is not returning the full data set for past meetings, can you clarify what is being returned vs. what you’re expecting? Are you not seeing meetings past a certain date, for example?

Additionally, can you please share the documentation for the exact endpoint you’re calling? It looks like you might be calling /report/meetings instead of /report/users/userId/meetings:

Let me know—thanks!
Will

Good morning Will,

The list I get is short, but it doesn’t appear to be restricted to a particular set of dates or to a particular set of users. I’m trying to get a list of all past meeting for account-affiliated users with number of participants listed; at present, I’m (trying) to pull a full list of meetings then go user-by-user and pull past meetings reports in order to capture the participant count field. Is it possible I’m mixing up “meetings” and “past meetings?” If I were pulling a list of “current,” never-started meetings, that might explain the sporadic nature of the data I’m getting back.

Hey @nerkes,

Thank you for providing additional information. When you make this call outside of Python, such as through Postman, do you see the same issues with the list of meetings returned? Would you be able to reproduce the issue in Postman for us and then send the request details that you’re using?

Thanks,
Max

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