function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ethan HanEthan Han 

Bulk API: batch won't include any records

Hi, I'm trying to import csv data by using Bulk API 2.0 
I was able to created a job:

url: 
https://myinstance.my.salesforce.com/services/data/v44.0/jobs/ingest
headers: 
Content-Type:application/json; charset=UTF-8
Authorization:session_id
Accept:application/json
body:
{
    "contentType" : "CSV",
    "object" : "Title__c",
    "operation" : "insert",
    "lineEnding": "CRLF"
}

and I was trying to do a test run for adding batch to a job with dummy csv content.

url:
https://myinstance.my.salesforce.com/services/data/v44.0/jobs/ingest/job_id/batches
headers:
Content-Type: text/csv
Accept: application/json
body:
Name
Test1
Test2
Test3

however, it won't import any record to the custom object 'Title__c'. I can see the queue is added to the job but it's has 0 records to run with.
User-added image

I was wondering if i'm missing something or doing something wrong. 
Thanks
NagendraNagendra (Salesforce Developers) 
Hi Ethan,

Sorry for this issue you are facing.

May I suggest you please try the below steps which worked fine for me.

1.) Open the .csv
2.) Ctrl+A to select all
3.) Copy this data
4.) Paste data into the body on the workbench
5.) Be sure to change the header to 'text/csv' and issue a PUT

Please let us know if the reply was helpful.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
Ethan HanEthan Han
Hi Nagendra,
Thank you for your suggestion but I tried the exact steps above on workbench:

workbench

and still getting 0 records:

Bulk Data Load Jobs