400 Bad response when creating meetings in JWT and Python (requests Module)

Using this template helps us debug your issues more effectively :slight_smile:

Description
I’m trying to create a meeting using zoom api with python requests module. And this is how my codes looks like:
my_headers = {“Authorization”: “Bearer MY_JWT_TOKEN”}

query = {

“topic”: “Test 01”,

“type”: 2,

“start_time”: “2022-01-02T01:00:00Z”,

“duration”: 30,

“schedule_for”: “myemail@gmail.com”,

“timezone”: “Europe/Berlin”,

“password”: “12345”,

“agenda”: “This is just for test”,

“settings”: {

"host_video": False,

"participant_video": False,

"cn_meeting": False,

"in_meeting": False,

"join_before_host": True,

"mute_upon_entry": True,

"watermark": False,

"use_pmi": False,

"approval_type": 2,

"audio": "both",

"auto_recording": "none",

"alternative_hosts": "",

"global_dial_in_countries": [

  ""

],

"registrants_email_notification": True

}

}

response = requests.post(“https://api.zoom.us/v2/users/me/meetings”, headers=my_headers, params=query)

print(response)

Error
I get 400 bad request

Which App Type (OAuth / Chatbot / JWT / Webhook)?
I’m using JWT, the token which zoom uses (it works when I try to get meetings)

@zubairthedeveloper,

Thank you for posting in the Developer Forum. Have you tried testing the request out in a tool like Postman first? Postman is super helpful for generating the code necessary to initiate the request. For example, here is a Python- request code snippet generated on success create a meeting request in Postman:

import requests
import json

url = "https://api.zoom.us/v2/users/YourEmailhere.com/meetings"

payload = json.dumps({
  "topic": "test6",
  "type": "2",
  "settings": {
    "close_registration": False,
    "cn_meeting": False,
    "enforce_login": False,
    "waiting_room": False,
    "focus_mode": True,
    "private_meeting": True
  }
})
headers = {
  'Authorization': 'Bearer Your Token Here',
  'Content-Type': 'application/json',
  'Cookie': '_zm_lang=en-US; _zm_mtk_guid=b2fed383f6f345c78ef07479027467b9; cred=FB94A6B7F6570132770EAB4D65F40FBA'
}

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

print(response.text)

Postman Screenshot for reference (PII Omitted):

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