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)
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?