Newer Version Available

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

Step 6: Query Jobs

This Bulk API 2.0 example shows you how to create a query job, monitor its progress, and get the job results.
  1. Create the job.

    URI

    Example of creating a bulk query job

    The response includes the job id and shows the job’s state as UploadComplete. (You use the job id to monitor the job or get its results.)

    Example response body

  2. Monitor the job’s state using the returned job id.

    URI

    Example of monitoring the state of the query job

    Example response body

    The response shows the current state of the job. Repeat this step until the state is JobComplete.

  3. Get the results of the job.

    URI

    Example of getting results of the job

    The response shows the results of the SOQL query when you created the query job.

    Example response body

    This example returns a small result set, and it’s easy to see the complete results. Queries that return larger results spread them across a sequence of result sets. To see the other result sets, use the locator to fetch the next set of results. For more information, see Get Results for a Query Job.