I am trying to make a rest call to a Microsoft calendar service. A generic curl call works however when trying to use the Moodle core Rest API I get an error saying: "clean_param() can not process arrays, please use clean_param_array() instead." from the rest.php, but I have to pass the array as shown below.
I tried json_encode for the parameters that are arrays but that didn't work either. I tried changing the interface for the service:
public function get_api_functions() {
return [
'add' => [
'endpoint' => 'https://graph.microsoft.com/v1.0/me/events',
'method' => 'post',
'args' => [
'subject' => PARAM_RAW,
'body' => [
'contentType' => PARAM_RAW,
'content' => PARAM_RAW
],
'start' => [
'dateTime' => PARAM_RAW,
'timeZone' => PARAM_RAW
]
'end' => [
'dateTime' => PARAM_RAW,
'timeZone' => PARAM_RAW
],
'location' => PARAM_RAW,
],
'response' => 'json'
],
];
}
$service->call('add', $params);
and
$service->call('add', $params, true);
and
$service->call('add', $params, json_encode($params));
Any help is greatly appreciated.
Best,
Mustafa