Hi, I am working on a product. I made a postman collection for Creatio. Everything works fine inside postman. I am successfully creating leads using the API. Now I am creating a PHP script with the same procedure. After authentication, I am getting the BMPCSRF token in Curl headers. When I try to create a lead, or contact using the updated BMPCSRF token, I am getting "400 bad request" error. I am passing all the required parameters in CURL headers. This is the CURL request.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://'. $creatioUrl .'.creatio.com/0/odata/Lead',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>json_encode($data->data),
CURLOPT_HTTPHEADER => array(
'ForceUseSession: true',
'BPMCSRF: '.$arr['BPMCSRF'],
'Content-Type: application/json',
'Content-Length: 0'
),
));
$response = curl_exec($curl);
curl_close($curl);
Kindly guide me on what I am doing wrong here because nothing is working after the Authentication.