我正在尝试从REST API中获取一些数据,我已经正确指定了参数,甚至我的访问令牌都是有效的,但我没有获得预期的响应,而是发出了以下HTTP请求:
CompletableFuture
我从API收到以下响应:
//set parameters
$paramRequest = array(
"title" => "Sample Daily meeting",
"agenda" => "Sample Agenda",
"password" => "BgJep@43",
"start" => "2020-07-01 15:00:00",
"end" => "2020-07-01 16:00:00",
"timezone" => "Asia/Shanghai",
"recurrence" => "FREQ=DAILY;INTERVAL=1;COUNT=10",
"enabledAutoRecordMeeting" => false,
"allowAnyUserToBeCoHost" => false,
);
$cURLConnection = curl_init("https://webexapis.com/v1/meetings");
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $paramRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURLConnection, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
'Connection: Keep-Alive',
'Authorization: Bearer ' . $token
));
//send HTTP POST request
$apiResponse = curl_exec($cURLConnection);
curl_close($cURLConnection);
// $apiResponse - available data from the API request
$jsonArrayResponse = json_decode($apiResponse);
//display response
print_r($jsonArrayResponse);