logo

Return error on Zoom API with custom_questions in Drupal 8

22
June

Return error on Zoom API with custom_questions in Drupal 8
By: Anonymous | Published On: Tue, 06/22/2021 - 13:28

Prob:


in Drupal 8 I have created custom code to post data in Zoom using ZOOM API.

I have added custom question in Zoom Dashboard as below

custom question ZOOM


Zoom API was working but when I added a custom question in Event then is showing an error as below

"[code] => 300 [message] => The parameter is required in custom_questions: Referred By."

 

Soln:
If you added a custom question then you have to pass their title and value in parameter, example below. Label of question in title and value in answer

code custom question ZOOM


Following code I using to post data through CURL in Zoom
 

 

		
		$email = ' ';
		$name = '';
		$surname = ' ';
		$communication_address = ' ';
		$location = ' ';
		$business = ' ';
		$profession = ' ';
		$mobile = ' ';
		

		$access_token = '';
		$zoom_meet_id = ' ';

		$curl = curl_init();
		curl_setopt_array($curl, array(
		CURLOPT_URL => "https://api.zoom.us/v2/meetings/$zoom_meet_id/registrants",
		CURLOPT_RETURNTRANSFER => true,
		CURLOPT_ENCODING => "",
		CURLOPT_MAXREDIRS => 10,
		CURLOPT_TIMEOUT => 30,
		CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
		CURLOPT_CUSTOMREQUEST => "POST",
		CURLOPT_POSTFIELDS => "{\"email\":\"$email\",\"first_name\":\"$name\",\"last_name\":\"$surname\",\"address\":\"$communication_address\",\"city\":\"$location\",\"country\":\"IN\",\"zip\":\"110011\",\"state\":\"DL\",\"phone\":\"$mobile\",\"industry\":\"Tech\",\"org\":\"$business\",\"job_title\":\"$profession\",\"purchasing_time_frame\":\"More Than 6 Months\",\"role_in_purchase_process\":\"Influencer\",\"no_of_employees\":\"1-20\",\"comments\":\"Excited to host you.\",\"custom_questions\":[{\"title\":\"Referred By\",\"value\":\"Email\"}]}",
		CURLOPT_HTTPHEADER => array(
		"authorization: Bearer $access_token",
		"content-type: application/json"
		),
		));
		$response = curl_exec($curl);
		$err = curl_error($curl);
		curl_close($curl);
		
		if ($err) {
		$err = "cURL Error #:" . $err;

		} else {
		$response = json_decode($response, true);

		}

Need Help ?