$requestData = '{
"templates": {
"field_data": {
"field_text_data": {
"Prénom":"'.$nom.'",
},
"field_boolean_data": {},
"field_date_data": {},
},
"actions": [
{
"recipient_name": "'.$nom.'",
"recipient_email": "'.$mail.'",
"action_id": "16183000000061014",
"signing_order": 1,
"role": "Stagiaire",
"verify_recipient": false,
"private_notes": "",
}
],
"notes": ""
}
}';
$POST_DATA = array(
'data' => $requestData,
);
$curl = curl_init("https://sign.zoho.com/api/v1/templates/16183000000061001/createdocument");
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization:Zoho-oauthtoken <OauthToken>',
));
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA);
$response = curl_exec($curl);
echo $response;
$jsonbody = json_decode($response);// contain filed tyes response
if($jsonbody->status == "success")
{
$created_request_id = $jsonbody->requests->request_id; //Save the ID from the response to update later
$status = $jsonbody->requests->request_status;
echo $status;
}
else //Error check for error
{
echo $jsonbody->message;
}
curl_close ($curl);