I am new to Salesforce. I was trying to integrate bulk api 2.0 to one of our internal php application. I was able to upload the csv file to Sales force and process it. But it returns records updated as 0 every time. There is no failures or nothing in the debug log. Can somebody advise what I am doing wrong here?
I hav tried calling the api, passing the same data in the csv as string and it gets updated successfully. Only when I upload the csv itself have problem.
Here is my code:
//code for creating the job id
$url = "$instance_url/services/data/v42.0/jobs/ingest";
$content = json_encode(array("object" => 'Account', "externalIdFieldName" => "Id","contentType"=>'CSV',"operation" => 'update',"lineEnding" => "LF"));
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Authorization: OAuth $access_token",
"Content-type: application/json; charset=UTF-8",
"Accept: text/csv"
));
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
//code for uploading the csv for bulk update
$url = "$instance_url/services/data/v42.0/jobs/ingest/7509D0000008eSuQAI/batches";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Authorization: OAuth $access_token",
"Content-type: text/csv",
"Accept: application/json"
));
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
$file = "test-3.csv";
curl_setopt($curl, CURLOPT_POSTFIELDS, $file);
curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);