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

**URL:** <https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659>\
**Category:** API and Webhooks\
**Created:** [December 4, 2020, 1:44pm UTC](https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659 "2020-12-04T13:44:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nerkes](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nerkes](https://devforum.zoom.us/u/nerkes)\
**Post date:** [December 4, 2020, 1:44pm UTC](https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659/1 "2020-12-04T13:44:06Z")

</div>

**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](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’])

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [December 7, 2020, 4:51pm UTC](https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659/2 "2020-12-07T16:51:17Z")

</div>

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`:

> **[Get Meeting Reports - Reports - Zoom API - API Reference](https://marketplace.zoom.us/docs/api-reference/zoom-api/reports/reportmeetings)**
>
> Retrieve report on a past meeting for a specified period of time. The time range for the report is limited to a month and the month should fall under th...

Let me know—thanks!  
Will

---

<div class="post-metadata">

**Author:** ![nerkes](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nerkes](https://devforum.zoom.us/u/nerkes)\
**Post date:** [December 8, 2020, 1:55pm UTC](https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659/3 "2020-12-08T13:55:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [December 9, 2020, 6:25pm UTC](https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659/4 "2020-12-09T18:25:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 9, 2021, 4:25am UTC](https://devforum.zoom.us/t/trouble-accessing-past-meetings-data-through-api-for-zoom-business-account-using-python/37659/5 "2021-01-09T04:25:45Z")

</div>

Closed on January 9, 2021, 4:25am UTC

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