Subscribe to Query Job Platform Events (Beta)
Use the standard platform event BulkApi2JobEvent to get query job status updates and
begin downloading results before the query job completes.
To enable this beta, follow these steps. You must have either the Modify All Data or the Customize Application permission.
- From Setup, in the Quick Find box, enter User Interface, and then select User Interface.
- On the User Interface page, select Enable Salesforce Platform Bulk API 2.0 Query Partial Download and Job Completion Events (Beta).
-
Choose a supported subscriber.
Use the /event/BulkApi2JobEvent channel to subscribe to Bulk API 2 query job platform events when configuring a subscription. See Subscribing to Platform Events.
-
Start a Bulk API 2 query job.
Your code can process events associated with the job ID in the response body. See Create a Query Job.
This event indicates job status. The unique ID in JobIentifier is the same ID that you get from the query job response body.
This event indicates that a set of results is available. Your client uses the unique URL in ResultUrl to get the results.
This event indicates that only one set of results remains. Your client uses the ResultUrl URL to get the last set of results.
{
"Type" : "JOB_STATE",
"JobIdentifier" : "750xx000004UeCCB",
"JobState" : "InProgress",
"ResultType" : null,
"ResultUrl" : null
}
{
"Type" : "RESULT",
"JobIdentifier" : "750xx000004UeCCB",
"JobState" : "InProgress",
"ResultType" : "PARTIAL",
"ResultUrl" : "https://mydomain.salesforce.com/services/data/v63.0/jobs/query/750xx000004UeCCB/results?locator:AOTUALft490873ALSH353w4oithw404FKJ"
}
{
"Type" : "RESULT",
"JobIdentifier" : "750xx000004UeCCB",
"JobState" : "JobComplete",
"ResultType" : "FINAL",
"ResultUrl" : "https://mydomain.salesforce.com/services/data/v63.0/jobs/query/750xx000004UeCCB/results?locator:aSdEft490873ALSH353w4oithw404jKlM"
}