Jenkins: Get a range of number numbers on a specific day
The built-in REST JSON API will give you a list of assemblies for a specific job: http://jenkins:8080/job/JOB_NAME/api/json?tree=builds[fullDisplayName,id,number,timestamp]&pretty=true
Produces something like:
{
"builds" : [
{
"fullDisplayName" : "JOB_NAME #113",
"id" : "2014-10-31_23-05-20",
"number" : 113,
"timestamp" : 1414821920808
},
{
"fullDisplayName" : "JOB_NAME #112",
"id" : "2014-10-31_17-26-39",
"number" : 112,
"timestamp" : 1414801599000
},
....
If your build IDs are base date stamp (as above), you can do a little string processing to filter the results. Otherwise, you can convert the timestamp to the appropriate date and filter it.
Most Jenkins pages have a REST API link at the bottom which provides more documentation, although you often need to experiment with the API to figure out what details it can provide.
Update: When @Nick is detected, the result is builds
limited to the last 100 items by default. According to this Jenkins issue , you can use a hidden item allBuilds
to fetch "all assemblies". So if you want all assemblies use:http://jenkins:8080/job/JOB_NAME/api/json?tree=allBuilds[fullDisplayName,id,number,timestamp]&pretty=true
Jenkins 1.568 also introduced pagination in the API results, so it is possible to get results by range. The JENKS REST API link describes the syntax if your Jenkins version supports it.
source to share