Interact with Audits
This API is added since QuickBuild 6.0.6.
Search Audits
Syntax
Audits can be searched using http GET method through below url:
http://localhost:8810/rest/audits?<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 |
---|---|
username | Name of the user to audit. If not specified, audit log of all users will be searched. |
source | Specify source of audit to match. The character * can be used in the source string to do wildcard match. If not specified, audits from all sources will be matched. |
action | Action of the audit to match. If left empty, any action will be matched. |
since | In the format of yyyy-MM-dd HH:mm, for example: 2009-11-12 13:00. If specified, search audits generated after this date |
until | In the format of yyyy-MM-dd HH:mm, for example: 2009-11-12 14:00. If specified, search builds generated before this date |
first | Specified first audit entry to return. If not specified, value 0 is assumed |
count | Specified number of audit entries to return. This param must be specified in order not to mistakenly return all audits to stress the system |
The response is of mime type application/xml, and the content is XML representation of list of matched builds. If no any search criterias are specified, all builds in the system will be returned.
Security
You will need to use http BASIC authentication to login as administrator if the anonymous does not have administative permission.
Demo
Below curl commands demonstrates how to combine different criterias to perform search:
-
Search recent 100 audit entries for user robin under configuration tree root/test :
curl -u admin:admin "http://localhost:8810/rest/audits?username=robin&source=root/test/*&count=100"
warningMake sure to append "/" to configuration path if you want to search against certain configuration as QuickBuild uses trailing slash to differenticate audits generated from configurations and other sources. In this example we also append * to end of source param to match all sub configurations under root/test
-
Search all audits bewteen generated after 2015-01-12 13:00 and after 2015-01-12 23:00 in the system:
curl -u admin:admin "http://localhost:8810/rest/audits?since=2015-01-12+13:00&until=2015-01-12+23:00"
warningHere we use 2015-01-12+13:00 instead of 2015-01-12 13:00 as the white space in query string has to be encoded as plus sign.
Count Audits
Counting audits uses the same syntax as searching audits, except that:
- It goes to url http://localhost:8810/rest/audits/count instead of http://localhost:8810/rest/audits.
- first and count param should not be specified.