Always get “Request Body should be a valid JSON object." when create a user


#1

POST https://api.zoom.us/v2/users

{

“action”: “autoCreate”,
“user_info”: {
“email”: “hahaha@bytedance.com”,
“type”: “basic”,
“password”: “1wW2e5367”
}
}


#2

Hi, 

Can you try to replace " basic" with " 1"? 

“type”: “basic”, -> “type”: “1”,

Thanks

Michael


#3

It works for me. Thank you.

May be you can change the response message.  I mean this request is indeed a valid json object.


#4

Hi, 

We’ll put in a request to change & display a more accurate message. 

Thanks

Michael


#5

Hi Michael,
I am trying to create meeting from my cURL call, for that I am sending data as follows

$headers = array (“Content-Type: application/json”);
$json_encode = json_encode($data1);
  - here $data1 having form data which I am sending

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);

if I print $data_json, then I got following output

{
 “topic”:“Get test meeting creation”,
 “type”:“2”,
 “start_time”:“2018-09-21’T’17:09:00’Z”,
 “duration”:60,
 “timezone”:“Colombo, India Standard Time”,
 “password”:"",
 “agenda”:“Test”,
 “recurrence”:{
    “type”:“1”,
    “repeat_interval”:“1”,
    “weekly_days”:"""",
    “monthly_day”:"""",
    “monthly_week”:"""",
    “monthly_week_day”:"""",
    “end_times”:"""",
    “end_date_time”:""""
  },
 “settings”:{
    “host_video”:“false”,
    “participant_video”:“false”,
    “cn_meeting”:“false”,
    “in_meeting”:“false”,
    “join_before_host”:“true”,
    “mute_upon_entry”:“false”,
    “watermark”:“false”,
    “use_pmi”:“false”,
    “approval_type”:“3”,
    “registration_type”:“1”,
    “audio”:“both”,
    “auto_recording”:“none”,
    “enforce_login”:“true”
 }
}

in above code of cURL if I print $response then I got the response as
string(68) “{“code”:300,“message”:“Request Body should be a valid JSON object.”}”

Please help me for this as soon as possible.

Thanks
Sachin


#6

Hi Sachin, 

The error has something to do with your request payload. Have you tried to paste your request payload into an JSON formatter and then use it within POSTman?

Thanks