Jenkins REST API - using tree to reference specific item in JSON array
The API documentation has a hint:
A newer alternative is the tree query parameter. [snip] you need only know what elements you are looking for, rather than what you are not looking for (which is anyway an open-ended list when plugins can contribute API elements). The value should be a list of property names to include, with subproperties inside square braces.
For a simple list, get the whole subtree with:
http://jenkins/job/myjob/../api/json?tree=artifacts[*]
or list specific properties within the braces.
For changeSet
, use
http://jenkins/job/myjob/../api/json?tree=changeSet[*[*]]
to retrieve everything.
Use nested square braces for specific sub-subproperties, e.g.:
http://jenkins/job/myjob/../api/json?tree=changeSet[items[revision]]
The tree documentation says that it's intended for cases where the caller doesn't know what properties to retrieve.