My Python code is not working to get the Meetings data

The following code is not working, it is suppose GET Meetings:

import jwt
import http.client
import datetime
import json

api_key = '.....'
api_sec = '.....'


payload = {
'iss': api_key,
'exp': datetime.datetime.now() + datetime.timedelta(hours=2)
}
jwt_encoded = str(jwt.encode(payload, api_sec), 'utf-8')

conn = http.client.HTTPSConnection("api.zoom.us")
headers = {
'authorization': "Bearer %s" % jwt_encoded,
'content-type': "application/json"
}
conn.request("GET", "/metrics/meetings", headers=headers)
res = conn.getresponse()
response_string = res.read().decode('utf-8')
response_obj = json.loads(response_string)
print(response_obj)

Hi @mohammed_zaid,

Have you tried testing the request out in a tool like Postman first? You might also find Postman helpful for generating the code necessary to initiate the request. If you don’t already have Postman, I recommend downloading it here:

Here is an example of a GET request in Python, which you may also find helpful:

import requests

url = "https://api.zoom.us/v2/metrics/meetings?type=past"

payload = {}
headers = {
  'Authorization': 'Bearer {token}'
}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

Thanks,
Will

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