Newer Version Available

This content describes an older version of this product. View Latest

Step 4: Close the Job

When you're finished submitting batches to Salesforce, close the job. This informs Salesforce that no more batches will be submitted for the job, which, in turn, allows the monitoring page in Salesforce to return more meaningful statistics on the progress of the job.
  1. Create a text file called close_job.txt containing the following text:
    1<?xml version="1.0" encoding="UTF-8"?>
    2<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
    3  <state>Closed</state>
    4</jobInfo>
  2. Using a command-line window, execute the following cURL command:

    curl https://instance.salesforce.com/services/async/51.0/job/jobId -H "X-SFDC-Session: sessionId" -H "Content-Type: application/xml; charset=UTF-8" -d @close_job.txt

    instance is the portion of the <serverUrl> element and sessionId is the <sessionId> element that you noted in the login response. jobId is the job ID that was returned when you created the job.

    This cURL command updates the job resource state from Open to Closed.