I have a hosted Jenkins server and from there, I am trying to fetch the build details (like result, timestamp, duration etc.) for all the jobs using the Jenkins REST API and then save it in my database.
Right now, I am calling the following API from my Java code, to fetch all the jobs (about 200 jobs):
https://<JENKINS_HOST>/api/json
Then I fetch the job details and all the builds for each job by using:
https://<JENKINS_HOST>/job/MY_JOB/api/json
Then finally, for each of the builds (I have to fetch only last 50), I have to call this to fetch the build details:
https://<JENKINS_HOST>/job/MY_JOB/<BUILD_NUMBER>/api/json
So that makes it about a total of 50*200 + 201 = over 10000 API calls.
I am guessing, These many API calls would make the Jenkins server perform slow?
So, my question is is there a faster/more optimal way to do this, So that I do not have to make so many API calls?
Something like where I can fetch all the build details using one url like this:(hypothetically)
https://<JENKINS_HOST>/job/MY_JOB/api/json?fetchAllbuildDetails=True