getting the following error when attempting to create ZOOM CC queue -
{‘code’: 300, ‘message’: ‘Request Body should be a valid JSON object.’}
Please note that the body is serialized in JSON, so I’m unclear why I’m receiving this response from ZOOM. Below are details of the request.
url: ‘https://api.zoom.us/v2/contact_center/queues’
body: {“queue_name”: “test-queue”, “queue_description”: “test-queue”, “channel”: “voice”}
Hi Rehema. Thanks for the quick response. Sure below is the method that is part of a class I wrote. I’m using a requests.Session() (class var self.S) object to make the API call.
:param queue_name: Name of queue.
:param queue_description: Description of queue.
:param channel: Channel type to be used by queue. [voice,video,messaging,email] (Default: voice)
:type queue_name: str
:type description: str
:type channel: str
'''
uri = self.base_url + f'contact_center/queues'
params = {
'queue_name': queue_name,
'queue_description': queue_description,
'channel': channel
}
r = self.S.post(uri, json=params, headers=self.headers)
return r
Thanks for sharing @ereyes. The issue might be that queue_description is being set to None, which gets serialized to null in the JSON request body. Some Zoom APIs don’t accept null values for optional fields — they expect the field to be omitted entirely if it’s not being used.
To fix this, you can update your code to only include queue_description in the request params if it has a value (example conditional below). That should prevent the API from rejecting the request. Please let me know if this resolves the issue.
params = {
'queue_name': queue_name,
'channel': channel
}
if queue_description is not None:
params['queue_description'] = queue_description
Hi Rehema. Thanks for your response. Although the default value for ‘queue_description’ is ‘None’, I did pass a string of “test-queue” as indicated in my initial post- body: {“queue_name”: “test-queue”, “queue_description”: “test-queue”, “channel”: “voice”}
Nonetheless I found the problem. Passing parameter “channel” into the body does not work. It seems that even though the documentation states “channel_types” is deprecated, that is still the one that works. See here- > Contact Center APIs