//the parameters or request body parameters
$postFields = array(
'data' => array(
'attributes' => array(
'resource_id' => "31nvpbc7a8956244b406d9b2fab919c1ed8b1",
'shared_type' => "everyone",
'role_id' => "6"
),
'type' => "permissions"
)
);
$data_to_post = json_encode($postFields);
$curl_variable = curl_init();
curl_setopt($curl_variable, CURLOPT_URL, $curl_url);
curl_setopt($curl_variable, CURLOPT_POST, 1);
curl_setopt($curl_variable, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_variable, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_variable, CURLOPT_POSTFIELDS, $data_to_post);
//curl_setopt($curl_variable, CURLOPT_POSTFIELDS, $data_to_post); =====> {"errors":[{"id":"F7007","title":"Invalid OAuth scope."}]}
//curl_setopt($curl_variable, CURLOPT_POSTFIELDS, $postFields); =====> {"errors":[{"id":"F6012","title":"Number of parameters is more than specified"}]}
//curl_setopt($curl_variable, CURLOPT_POSTFIELDS, $postFields); =====> Warning: Array to string conversion in D:\xampp\htdocs\bluedot\zoho-work-drive-share-file.php on line 91
// curl_setopt($curl_variable, CURLOPT_POSTFIELDS, http_build_query($postFields)); =====> {"errors":[{"id":"F000","title":"JSON_PARSE_ERROR"}]}
curl_setopt($curl_variable, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token, 'cache-control: no-cache'));
$response = curl_exec($curl_variable);
$err = curl_error($curl_variable);
if ($err) {
echo "cURL Error #:" . $err;
} else{
echo '<pre>';
print_r($response);
}