I am using the below url to retrieve my jenkins status along with other additional details. The URL works fine for single-build instance. If there are multiple build instances the response is not coming in a proper format.
Is there anyway to tell jenkins give the response in array structure with proper tag.
URL :
https://<jenkinsurl>/job/<jobname>/api/xml?tree=builds[number,url,result,duration,estimatedDuration,actions[parameters[name,value]]]&pretty=true&xpath=(//workflowJob/build[action[parameter[name=%27rulesetid%27%20and%20value=%276363d07c8e70eb588c5ac127%27]]]/number)%7C(//workflowJob/build[action[parameter[name=%27rulesetid%27%20and%20value=%276363d07c8e70eb588c5ac127%27]]]/result)%7C(//workflowJob/build[action[parameter[name=%27rulesetid%27%20and%20value=%276363d07c8e70eb588c5ac127%27]]]/duration)%7C(//workflowJob/build[action[parameter[name=%27rulesetid%27%20and%20value=%276363d07c8e70eb588c5ac127%27]]]/estimatedDuration)%7C(//parameter[name=%27rulesetid%27%20and%20value=%276363d07c8e70eb588c5ac127%27])&wrapper=builds
Actual Response :
<builds>
<parameter _class="hudson.model.TextParameterValue">
<name>rulesetid</name>
<value>6363d07c8e70eb588c5ac127</value>
</parameter>
<duration>54297</duration>
<estimatedDuration>88481</estimatedDuration>
<number>169</number>
<result>FAILURE</result>
<parameter _class="hudson.model.TextParameterValue">
<name>rulesetid</name>
<value>6363d07c8e70eb588c5ac127</value>
</parameter>
<duration>44608</duration>
<estimatedDuration>88481</estimatedDuration>
<number>167</number>
<result>FAILURE</result>
</builds>
Expected Response :
<builds>
<build>
<parameter _class="hudson.model.TextParameterValue">
<name>rulesetid</name>
<value>6363d07c8e70eb588c5ac127</value>
</parameter>
<duration>54297</duration>
<estimatedDuration>88481</estimatedDuration>
<number>169</number>
<result>FAILURE</result>
</build>
<build>
<parameter _class="hudson.model.TextParameterValue">
<name>rulesetid</name>
<value>6363d07c8e70eb588c5ac127</value>
</parameter>
<duration>44608</duration>
<estimatedDuration>88481</estimatedDuration>
<number>167</number>
<result>FAILURE</result>
</build>
</builds>