I'm getting "Request Body should be a valid JSON object."


#1

Hi for all.

Im getting this error and i cant fix it.

Im using firebase/php-jwt for generating the token successfully.

Im using guzzle/guzzle as php client.

You can see my code here.

$url = sprintf('https://api.zoom.us/v2/users/%s/meetings', $this-\>user);
$response = $this-\>guzzle-\>request(
 'POST',
 $url,
 [
 'body' =\> json\_encode(
 [
 'topic' =\> 'Prueba de Reunión 1',
 'type' =\> 2,
 'start\_time' =\> $date-\>format('Y-m-d\TH:i:s'),
 'duration' =\> 45,
 'timezone' =\> 'Europe/Madrid',
 'agenda' =\> 'Prueba de Reunión 1',
 'settings' =\>
 [
 'host\_video' =\> true,
 'participant\_video' =\> true,
 'join\_before\_host' =\> true,
 'mute\_upon\_entry' =\> 'boolean',
 'watermark' =\> 'boolean',
 'audio' =\> 'voip',
 'auto\_recording' =\> 'cloud',
 ]
 ,
 ]
 ),
 'headers' =\> [
 'Content-Type'=\> 'application/json',
 'Authorization' =\> ['Bearer '.$this-\>token],
 ],
 ]
);

This is the details of request in our profiler.

Header Value
Content-Length 328
User-Agent She Herencia/1.0
Host api.zoom.us
Content-Type application/json
Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJRUzZTWlZTUVI0MlhnY09WLWJPQ3pBIiwiZXhwIjoxNTI3MDYzMTE3fQ.125qXbxrQTVaz-3XubvOBGEOEsO5yNw6XVBImmwI4F4

Content

{
    "topic": "Prueba de Reuni\u00f3n 1",
    "type": 2,
    "start_time": "2018-05-23T10:21:57",
    "duration": 45,
    "timezone": "Europe\/Madrid",
    "agenda": "Prueba de Reuni\u00f3n 1",
    "settings": {
        "host_video": true,
        "participant_video": true,
        "join_before_host": true,
        "mute_upon_entry": "boolean",
        "watermark": "boolean",
        "audio": "voip",
        "auto_recording": "cloud"
    }
}

and this is the response in profile system.

Header Value
Date Wed, 23 May 2018 08:07:00 GMT
Content-Type application/json;charset=UTF-8
Content-Length 68
Connection keep-alive
Server ZOOM
Cache-Control no-cache, no-store, must-revalidate
Pragma no-cache
Expires Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie cred=D220FCF2073B2FDD9744A017BAE81E5D; Path=/; Secure; HttpOnly
x-zm-trackingid cf624fcde4af438db20bd94a7e2a1120

Content

{
    "code": 300,
    "message": "Request Body should be a valid JSON object."
}

Have someone any idea that what thing we are doing wrong?

Regars

 

 


#2

Hi Daniel, 

Within your body that you are sending, can you change the values of mute_upon_entry & watermark to either true or false? That should work afterwards. 

"mute_upon_entry": "boolean",
        "watermark": "boolean",

Thanks

Michael

 


#3

Yes,

Those two properties either set to ‘True’ or ‘False’ or remove if you think they are not required, should fix the issue.

Thanks

Motilal