diff --git a/core/pom.xml b/core/pom.xml
index 643a5fc7e790b445428941d474d056a5ff024eee..e371b10312cf80bfc3c55f24a26b6f1051820956 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -272,7 +272,7 @@
org.kohsuke.stapler
stapler
- 1.56
+ 1.57
org.kohsuke
diff --git a/core/src/main/java/hudson/model/Api.java b/core/src/main/java/hudson/model/Api.java
index 1f73080ff388dd45a16e02aa255a4d5d0e84667f..fce90bb9c150a3950de6146466b33bb727cd64a0 100644
--- a/core/src/main/java/hudson/model/Api.java
+++ b/core/src/main/java/hudson/model/Api.java
@@ -52,7 +52,10 @@ public class Api extends AbstractModelObject {
/**
* Exposes the bean as XML.
*/
- public void doXml(StaplerRequest req, StaplerResponse rsp, @QueryParameter("xpath") String xpath, @QueryParameter("wrapper") String wrapper) throws IOException, ServletException {
+ public void doXml(StaplerRequest req, StaplerResponse rsp,
+ @QueryParameter("xpath") String xpath,
+ @QueryParameter("wrapper") String wrapper,
+ @QueryParameter("depth") int depth) throws IOException, ServletException {
if(xpath==null) {
// serve the whole thing
rsp.serveExposedBean(req,bean,Flavor.XML);
@@ -63,7 +66,7 @@ public class Api extends AbstractModelObject {
// first write to String
Model p = MODEL_BUILDER.get(bean.getClass());
- p.writeTo(bean,Flavor.XML.createDataWriter(bean,sw));
+ p.writeTo(bean,depth,Flavor.XML.createDataWriter(bean,sw));
// apply XPath
Object result;
diff --git a/core/src/main/resources/hudson/model/Api/index.jelly b/core/src/main/resources/hudson/model/Api/index.jelly
index 18f2b65677e0e86f3f38757849c9535b5878b809..12a6178a20fc5422cf9559ad8e252a24a3962c21 100644
--- a/core/src/main/resources/hudson/model/Api/index.jelly
+++ b/core/src/main/resources/hudson/model/Api/index.jelly
@@ -36,6 +36,16 @@
the documentation.
+ Controling the amount of data you fetch
+
+ In both formats, the depth query parameter can be used to control the amount of data
+ you'll receive. The default is depth=0, but by increasing this value you can get
+ a lot of data by single remote API invocation (the downside is bigger bandwidth requirement.)
+ Compare depth=0 and depth=1 and see what the difference
+ is for yourself. Also note that data created by a smaller depth value is always a subset of
+ the data created by a bigger depth value.
+
+