Hello!
I try create deal via API. I recive access_token and put it in this code:
public function insert(){
$access_token = '1000.917e9c46e56677a285f4ac1b3f6d4298.ce3f663d3546f947b02583149a941b55';
$post_data = [
'data' => [
[
"Deal_Name" => "Roga",
"Stage" => "Kopyta; fdf"
]
],
'trigger' => [
"approval"
]
];
$ch = curl_init();
$curl_options = array();
$url = "https://www.zohoapis.eu/crm/v2/Deals";
curl_setopt($ch, CURLOPT_URL , $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, array('Authorization: Zoho-oauthtoken'. $access_token, 'Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
var_dump($response);
}
And I receive this:
array(1) { [0]=> string(790) "HTTP/1.1 401 Server: ZGS Date: Sat, 09 Oct 2021 13:05:08 GMT Content-Type: application/json;charset=utf-8 Content-Length: 98 Connection: keep-alive Set-Cookie: 4993755637=2ca2d837b378298e90e09e13412c44aa; Path=/ Referrer-Policy: strict-origin X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Set-Cookie: crmcsr=b6d4bc04-8d05-44d2-962d-024f8ded9f16;path=/;Secure;priority=high Set-Cookie: _zcsr_tmp=b6d4bc04-8d05-44d2-962d-024f8ded9f16;path=/;SameSite=Strict;Secure;priority=high Pragma: no-cache Cache-Control: private,no-cache,no-store,max-age=0,must-revalidate Expires: Thu, 01 Jan 1970 00:00:00 GMT X-Frame-Options: SAMEORIGIN X-Download-Options: noopen {"code":"AUTHENTICATION_FAILURE","details":{},"message":"Authentication failed","status":"error"} " }