0

I am trying to create a daily report for bulk api usage in the org.

The information I need to have in that alert is:

userId,jobId,entityType,verb,startTime,endTime,totalProcessedTime,batches,retries,recordsProcessed,recordsFailed,recordsSuccessful

I do have the preliminary logic set up where by:

1). I make an endpoint call to: services/data/v52.0/jobs/query/ to get all the jobs (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/query_get_all_jobs.htm)

2). Looping through all the jobs, I make end point call to : services/async/52.0/job/(jobId) to get job details for each job. (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_jobs_get_details.htm)

enter image description here

However my understanding is that in #2 above, I am only getting info for legacy Bulk API jobs and not Bulk 2.0 as Bulk API 2.0 handles batches itself.

My Understanding: For me to incorporate Bulk 2.0 job details in my alert, I will need to use the jobType from # 1 above and if it is V2Query or V2Injest, that I make a end point call to : /services/data/vXX.X/jobs/ingest/jobID or /services/data/vXX.X/jobs/query/queryJobId as needed. Both these end points provide numberRecordsProcessed and since it is bulk 2.0, we can just do numberRecordsProcessed/10000 (rounded to nearest whole number) in order to get the number of batches. This due to "Salesforce creates a separate batch for every 10,000 records in your job data, up to a daily maximum of 150,000,000 records." Is my understanding correct?

1 Answer 1

1

For Bulkv2 Ingest, sfdc manages the batches internally (which is 10k recorrds per batch).

For Bulkv2 query, there is essentially no batching. But you could use api calls you listed to get total records processed and extrapolate batches as total records/10k. But you will not get individual batch ids in v2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.