You need to sign in to do that
Don't have an account?

Leads web service call
Hi,
How can I create a job that retrieves all the Leads records?
I currently have these codes, are these correct?
Also, what should be the content of my csv file?
How can I create a job that retrieves all the Leads records?
I currently have these codes, are these correct?
public static void main(String[] args) throws AsyncApiException, ConnectionException, IOException { BulkExample example = new BulkExample(); // Replace arguments below with your credentials and test file name // The first parameter indicates that we are loading Account records // example.runSample("Account", "myUser@myOrg.com", "myPassword", "mySampleData.csv"); example.runSample("Lead", "email@myemail.com", "password", "mySampleData.csv"); } private JobInfo createJob(String sobjectType, BulkConnection connection) throws AsyncApiException { JobInfo job = new JobInfo(); job.setObject(sobjectType); // job.setOperation(OperationEnum.insert); job.setOperation(OperationEnum.query); job.setContentType(ContentType.CSV); job = connection.createJob(job); System.out.println(job); return job; }
Also, what should be the content of my csv file?
I can see you are creating the Query job (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_jobs_create.htm)above. Is there more code to add the actual query?
Generally speaking, you need to follow the steps in Use Bulk Query (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_using_bulk_query.htm). You will POST the SOQL query to https://instance_name—api.salesforce.com/services/async/APIversion/job/jobid/batch after first creating the Job.