I need to know if its possible to make a curl, and with a XML response, parse a field and get that value in a variable within a windows batch file.
My idea is to do the following curl:
curl -X GET "http://server/app/rest/buildTypes/id:4545785/builds?count=1&state=finished"
which returns the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<builds count="1" href="/app/rest/buildTypes/id:4545785/builds?count=1&state=finished" nextHref="/app/rest/buildTypes/id:4545785/builds?state=finished&locator=start:1,count:1">
<build id="52" buildTypeId="4545785" number="51" status="SUCCESS" state="finished" href="/app/rest/builds/id:52" webUrl="http://server/viewLog.html?buildId=52&buildTypeId=4545785" />
</builds>
I need to extract the value of status and then exit batch with a specific code: if "SUCCESS" exit with 0 or else exit with -1.
Is this possible?
Comments
Post a Comment