Importing Records

To import records, an authenticated user creates an import job, adds batches of data to it, closes the job, checks for completion, and then retrieves the results. The results are provided per batch and indicate the status of each imported record. Examples of each step in this process are provided in the remainder of this subsection.

Listing 11.4 creates a bulk import job. It specifies that the records in the job are to be inserted into the Project custom object from a CSV file.

Listing 11.4 Creating a Bulk Import Job

echo '<?xml version="1.0" encoding="UTF-8"?>  <jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">  <operation>insert</operation>  <object>Project__c</object>  <contentType>CSV</contentType></jobInfo>' ...

Get Development with the Force.com Platform: Building Business Applications in the Cloud, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.