I’m new to both Zoom APIs and Python, and I’m running into an issue that I hope is easy to resolve. I am attempting to loop through all meetings to pull back some data. By using the sample code in the API documentation, I have been able to pull back the first page of data, including the value for next_page_token. However, I am stuck at trying to use next_page_token in order to return any more data.
What returns is:
{‘code’: 300, ‘message’: ‘The next page token is invalid or expired.’}
I know I’m missing something basic, but I don’t know what it is, and I’m stuck. Any advice would be appreciated.
#################################
import http.client
import json
conn = http.client.HTTPSConnection(“api.zoom.us”)
headers = { ‘authorization’: “Bearer ABC123” } #[changed to generic info for posting purposes]
conn.request(“GET”, “/v2/metrics/meetings?page_size=2&to=2020-06-02&from=2020-05-01&type=past”, headers=headers)
res = conn.getresponse()
data = res.read()
dataStr = data.decode(“utf-8”)
response_obj = json.loads(dataStr)
for x in response_obj[‘meetings’]:
print(x[‘email’])
strNextToken = response_obj[‘next_page_token’]
print(strNextToken)
I know this should be a loop, but at this point I can’t even get one more page of data…
if strNextToken:
conn.request(“GET”, “/v2/metrics/meetings?from=2020-05-01&next_page_token=strNextToken&page_size=30&to=2020-06-02&type=past”, headers=headers)
res = conn.getresponse()
data = res.read()
dataStr = data.decode(“utf-8”)
response_obj = json.loads(dataStr)
#print(data.decode(“utf-8”))
print(response_obj)
else:
print(“No Next Page Token”)
#################################