Interact with Builds
Access build by build id
Syntax
Build can be accessed by id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>
The response is of mime type application/xml, and the content is XML representation of the build.
Security
You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.
Demo
Below curl command demostrates how to access XML representation of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14
Access build status by build id
Syntax
Build status can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/status
The response is of mime type text/plain, and the content is string representation of the build status.
Security
You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.
Demo
Below curl command demostrates how to access status of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/status
Access build begin date by build id
Syntax
Build begin date can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/begin_date
The response is of mime type text/plain, and the content is string representation of build begin date (mill-seconds since January 1, 1970, 00:00:00 GMT)
Security
You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.
Demo
Below curl command demostrates how to access begin date of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/begin_date
Access build version by build id
Syntax
Build version can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/version
The response is of mime type text/plain, and the content is string representation of the build version.
Security
You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.
Demo
Below curl command demostrates how to access version of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/version
Access build duration by build id
Syntax
Build duration can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/duration
The response is of mime type text/plain, and the content is string representation of the build duration (milli-seconds). Status 204 (No Content) will be returned if build is not finished.
Security
You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.
Demo
Below curl command demostrates how to access duration of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/duration
{Interact+with+Builds}
Get build request id by build id
Syntax
Build request id can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/request_id
The response is of mime type text/plain, and the content is string representation of the build request id. Status 204 (No Content) will be returned if build is finished.
Security
You will need to use http BASIC authentication to login as an authorized QuickBuild user if the anonymous does not have permission to access belonging configuration of requested build.
Demo
Below curl command demostrates how to get request id of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/request_id
Access executed steps by build id
Syntax
Executed steps of a build can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/steps
The response is of mime type application/xml, and the content is XML representation of the list of steps executed in the build.
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have permission to access settings of belonging configuration.
Demo
Below curl command demostrates how to access executed steps by build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/steps
Access used repositories by build id
Syntax
Used repositories of a build can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/repositories
The response is of mime type application/xml, and the content is XML representation of the list of repositories used in the build.
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have permission to access settings of belonging configuration.
Demo
Below curl command demostrates how to access used repositories by build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/repositories
Access dependency builds by build id
Syntax
All dependency builds whose artifacts are used by current build can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/dependencies
The response is of mime type application/xml, and the content is XML representation of the list of dependency builds of specified build.
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have permission to access all dependency builds of specified build.
Demo
Below curl command demostrates how to access dependency builds of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/dependencies
Access dependent builds by build id
Syntax
All dependent builds who using artifacts of current build can be accessed by build id using http GET method through below url:
http://localhost:8810/rest/builds/<build id>/dependents
The response is of mime type application/xml, and the content is XML representation of the list of dependent builds of specified build.
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have permission to access all dependent builds of specified build.
Demo
Below curl command demostrates how to access dependent builds of build with id 14:
curl -u admin:admin http://localhost:8810/rest/builds/14/dependents
Search Builds
Syntax
Builds can be searched using http GET method through below url:
http://localhost:8810/rest/builds?<search criteria1>=<value1>&<search criteria2>=<value2>&...
Query string part of the url represents various search criterias to restrict the search result. Supported search criterias are:
Search criteria | Explanation |
---|---|
configuration_id | This tells QuickBuild under which configuration id to search builds. If not specified, all configurations will be searched. |
recursive | If set to true , QuickBuild will also search builds in all descendent configurations of specified configuration. The value is assumed as false if not specified. |
from_date | In the format of yyyy-MM-dd , for example: 2009-11-12. If specified, search builds generated after this date |
to_date | In the format of yyyy-MM-dd , for example: 2009-11-12. If specified, search builds generated before this date |
version | Specify the build version to match. The character * can be used in the version string to do wildcard match. If not specified, all versions will be matched. |
status | Status of the build to match. Valid build statuses are: SUCCESSFUL , FAILED , RECOMMENDED , CANCELLED , RUNNING , TIMEOUT. If left empty, any build status will be matched. |
user_id | Match builds which is triggered by specified user. If not specified, builds triggered by any user will be matched. |
first | Specify start position of search results. Position 0 is assumed if this param is not specified. |
count | Specify number of builds to return. This parameter is required. |
The response is of mime type application/xml, and the content is XML representation of list of matched builds.
The parameter count is required to limit the returned result set in order not to put heavy load on the server.
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have permission to access returned builds.
Demo
Below curl commands demonstrates how to combine different criterias to perform search:
-
Search all failed builds under configuration with id 2 :
curl -u admin:admin "http://localhost:8810/rest/builds?configuration_id=2&status=FAILED&count=100"
-
Search all successful builds generated before 2009-11-12 in the system:
curl -u admin:admin "http://localhost:8810/rest/builds?status=SUCCESSFUL&to_date=2009-11-12&count=100"
-
Search all failed builds with version containing qa :
curl -u admin:admin "http://localhost:8810/rest/builds?version=*qa*&status=FAILED&count=100"
Count Builds
Syntax
Builds can be counted using http GET method through below url:
http://localhost:8810/rest/builds/count?<search criteria1>=<value1>&<search criteria2>=<value2>&...
Query string part of the url represents various search criterias to restrict the search result. Supported search criterias are:
Search criteria | Explanation |
---|---|
configuration_id | This tells QuickBuild under which configuration id to search builds. If not specified, all configurations will be searched. |
recursive | If set to true , QuickBuild will also search builds in all descendent configurations of specified configuration. The value is assumed as false if not specified. |
from_date | In the format of yyyy-MM-dd , for example: 2009-11-12. If specified, search builds generated after this date |
to_date | In the format of yyyy-MM-dd , for example: 2009-11-12. If specified, search builds generated before this date |
version | Specify the build version to match. The character * can be used in the version string to do wildcard match. If not specified, all versions will be matched. |
status | Status of the build to match. Valid build statuses are: SUCCESSFUL , FAILED , RECOMMENDED , CANCELLED , RUNNING , TIMEOUT. If left empty, any build status will be matched. |
user_id | Match builds which is triggered by specified user. If not specified, builds triggered by any user will be matched. |
promoted_from_id | If specified, match builds which is promoted from specified build |
The response is of mime type text/plain, and the content is string representation of number of builds matching search criterias. If no any search criterias are specified, all builds in the system will be counted.
Security
Any user can call this RESTful API to count builds in system.
Demo
Below curl commands demonstrates how to combine different criterias to perform build counting:
-
Count all failed builds under configuration with id 2 :
curl -u admin:admin "http://localhost:8810/rest/builds/count?configuration_id=2&status=FAILED"
-
Count all successful builds generated before 2009-11-12 in the system:
curl -u admin:admin "http://localhost:8810/rest/builds/count?status=SUCCESSFUL&to_date=2009-11-12"
-
Count all failed builds with version containing qa :
curl -u admin:admin "http://localhost:8810/rest/builds/count?version=*qa*&status=FAILED"
Update build
Syntax
Build can be updated by posting XML representation of the build to below url:
http://localhost:8810/rest/builds
Please note that the configuration element denotes id of the belonging configuration.
Normally you do not need to create the XML from scratch: you may retrieve XML representation of the build using the http GET method, modify certain parts of the XML and post back to above url.
The response is of mime type text/plain and the content is string representation of the build id being updated.
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have SAVE_BUILD permission on the belonging configuration.
Demo
We will use curl to demonstrate how to move the build to be under another configuration. Let's assume the build id is 100 , and the destination configuration id is 6.
-
Retrieve xml representation of desired build into a temp file using below command:
curl -u admin:admin http://localhost:8810/rest/builds/100 > tempfile.xml
-
Edit tempfile.xml and change the configuration property to take the value 6.
-
Post back modified content using below command:
curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/builds
Moving builds to other configurations is not suggested since it will result in inaccurate change sets when compare builds in the original configuration.
Create build
Syntax
Build object can be created by posting XML representation of the build to below url:
http://localhost:8810/rest/builds
Please note that:
- The posted xml should NOT contain the id element; otherwise, QuickBuild will treat the post as an updating to the build with that id.
- The configuration element denotes id of the belonging configuration.
Normally you do not need to create the XML from scratch: you may retrieve XML representation of a templating build using the http GET method, remove the id element, modify certain parts and post back to above url.
The response is of mime type text/plain and the content is string representation of id of the newly created build.
This is different from [requesting new build](Interact with Build Requests.html#InteractwithBuildRequests-requestnewbuild) in the system. It simply adds a build object in the system, and is normally used to move build objects between different servers or configurations.
Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administrative rights.
Demo
We will use curl to demonstrate how to create a new build by copying an existing build with id 100.
-
Retrieve xml representation of build with id 100 into a temp file using below command:
curl -u admin:admin http://localhost:8810/rest/builds/100 > tempfile.xml
-
Edit tempfile.xml to remove the id element, and change other properties as desired.
-
Post back modified content using below command:
curl -X POST -u admin:admin -d@tempfile.xml http://localhost:8810/rest/builds
Delete Build
Syntax
Build can be deleted using http DELETE method through below url:
http://localhost:8810/rest/builds/<build id>
This service simply deletes the build object in database, and is different from build cacellation. You may follow below steps to cancel a running build:
- Get build request id
- [Delete the build request](Interact with Build Requests.html#InteractwithBuildRequests-deletebuildrequest) with build request id if it is not empty
Security
You will need to use http BASIC authentication to login as authorized QuickBuild user if the anonymous does not have DELETE_BUILD permission on the belonging configuration.
Demo
Below curl command demonstrates how to delete the build with id 100:
curl -X DELETE -u admin:admin http://localhost:8810/rest/builds/100