Not getting full response from API


#1

I have the api working, and I’m succesfully creating users no problem. 

However, on my end when I parse the response, whether in XML or JSON, I’m only getting a partial response with “…” at the end. I don’t know if that’s on my end or ZOOM’s end but if anyone has thoughts I’d appreciate it! 

Here’s a var_dump of the xml response, you can see where it ends at the disable_recording element. Thanks! 

| string(2198) “<?xml version=“1.0” encoding=“UTF-8”?> |
|   | <result> |
|   | <id>TwI0-Y2vS8GrzQtfp8R3GQ</id> |
|   | <email>test496404167@domain.com</email> |
|   | <first_name>David</first_name> |
|   | <last_name></last_name> |
|   | <pic_url></pic_url> |
|   | <type>1</type> |
|   | <disable_chat>false</disable_chat> |
|   | <disable_private_chat>false</disable_private_chat> |
|   | <enable_e2e_encryption>false</enable_e2e_encryption> |
|   | <enable_silent_mode>false</enable_silent_mode> |
|   | <disable_group_hd>false</disable_group_hd> |
|   | <disable_recording>false</disable_reco”… |


#2

I ran it in the playground at got the response below, can you share what your code that makes the request looks like (hiding you key/secret)

{
“id”: “Iez8-viBQf2Ti_hoQcbSxQ”,
“email”: “test496404167@domain.com”,
“first_name”: “”,
“last_name”: “”,
“pic_url”: “”,
“type”: 1,
“disable_chat”: false,
“disable_private_chat”: false,
“enable_e2e_encryption”: false,
“enable_silent_mode”: true,
“disable_group_hd”: false,
“disable_recording”: false,
“enable_large”: false,
“large_capacity”: 0,
“enable_webinar”: false,
“webinar_capacity”: 0,
“disable_feedback”: true,
“disable_jbh_reminder”: false,
“disable_cancel_meeting_notification”: false,
“enable_cmr”: false,
“enable_auto_recording”: false,
“enable_cloud_auto_recording”: false,
“enable_breakout_room”: true,
“enable_polling”: false,
“enable_annotation”: true,
“enable_auto_saving_chats”: false,
“enable_co_host”: true,
“enable_enter_exit_chime”: false,
“enable_remote_support”: false,
“enable_file_transfer”: false,
“enable_virtual_background”: false,
“enable_attention_tracking”: false,
“enable_waiting_room”: false,
“enable_closed_caption”: false,
“enable_far_end_camera_control”: false,
“enable_share_dual_camera”: false,
“enable_phone_participants_password”: false,
“enable_use_pmi”: false,
“enable_auto_delete_cmr”: false,
“auto_delete_cmr_days”: 0,
“verified”: 0,
“pmi”: 6643718568,
“meeting_capacity”: 0,
“created_at”: “2017-06-02T15:07:12Z”,
“token”: “”,
“status”: 0
}


#3

Thanks Joshua. The code is the php library taken directly from the zoom website with slight modification, making believe it is likely something on my end, but I’m just not sure what it could be. Here’s what I have. The last line I’ve tried parsing/decoding it in different ways: 

class ZoomAPI{

/*The API Key, Secret, & URL will be used in every function.*/
private $api_key = ‘xxx’;
private $api_secret = ‘xxx’;
private $api_url = ‘https://api.zoom.us/v1/’;

/*Function to send HTTP POST Requests*/
/*Used by every function below to make HTTP POST call*/
function sendRequest($calledFunction, $data){
/*Creates the endpoint URL*/
$request_url = $this->api_url.$calledFunction;

/*Adds the Key, Secret, & Datatype to the passed array*/
$data[‘api_key’] = $this->api_key;
$data[‘api_secret’] = $this->api_secret;
$data[‘data_type’] = ‘XML’;

$postFields = http_build_query($data);
/*Check to see queried fields*/
/*Used for troubleshooting/debugging*/

/*Preparing Query…*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);

/*Check for any errors*/
$errorMessage = curl_exec($ch);
curl_close($ch);

/*Will print back the response from the call*/
/*Used for troubleshooting/debugging */
//var_dump($data);
echo “<pre>”; var_dump($response); exit();
echo “<hr><hr>”;
if(!$response){
return false;
}

/*Return the data in JSON format*/

return json_encode($response);
}
/*Functions for management of users*/

function createAUser($params){
$createAUserArray = array();
$createAUserArray[‘email’] = $params[‘email’];
$createAUserArray[‘type’] = $params[‘type’];
$createAUserArray[‘first_name’] = $params[‘first_name’];
createAUserArray['last\_name'] = _POST[‘last_name’];
return $this->sendRequest(‘user/create’, $createAUserArray);
}

}

*****

$zoomCreateUser=new ZoomAPI();
$r = $zoomCreateUser->createAUser(
array(
“email”=>“x@domain.com”,
“type”=>“1”,
“first_name”=>“Dan”,
“last_name”=>“Smith”,
)
);

$resp=json_decode(html_entity_decode($r),true);


#4

Where (what environment) are you running this code? I ran what you have in mac terminal and I get the full response, not sure what could be truncating your response with the “…” appended. However you can see the “string(2198)” from the var_dump and everything up to the “…” is not 2198 in length. So I assume it’s just something when you go to display that is truncating it.


#5

For some reason I was able to get the full response in XML, so I’m rolling with that. I appreciate your help with it. If I figure it out later I’ll come back and post the solution in case it can help others. I assume its a config val or something in our ini, so I’ll check with the admins on it. 

Thanks!


#6

Hey Raymond,

 

Looking closer, I see you are doing a var_dump and exiting early. At that point the response is just a string (and may be getting truncated.

 

Also noticed the sample code is wrong

/\*Return the data in JSON format\*/return json\_encode($response);

Should be

/\*Return the data in JSON format\*/return json\_decode($response);

If you change your data_type back to JSON you should get what you’re looking for

$data['data\_type'] = 'JSON';  
...  
  
$response = curl\_exec($ch);  
  
$data = json\_decode($response);  
  
var\_dump($data);  
...