GetAuditData
API Request
URLs
GET zstack/v1/zwatch/audits
Headers
Authorization: OAuth the-session-uuid
Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/audits?startTime=1.557300700509E12&limit=50.0&auditType=Resource
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
startTime | Long | query | Optional. The start time. | 2.3 | |
endTime | Long | query | Optional. The end time. | 2.3 | |
limit | Integer | query | Optional. The maximum number of returned records. | 2.3 | |
labels | List | query | Optional. The filter label list. | 2.3 | |
auditType | AuditType | query | Optional. The audit type. |
|
3.5.0 |
systemTags | List | query | Optional. The system tags. | 2.3 | |
userTags | List | query | Optional. The user tags. | 2.3 |
API Response
Sample
Response
{
"audits": [
{
"resourceUuid": "b1ca3fab6ebc4302ad9249d5402cb06c",
"resourceType": "VmInstanceVO",
"clientIp": "172.0.0.1",
"clientBrowser": "Chrome/69.0.3497.81",
"apiName": "org.zstack.header.vm.APISetVmRDPMsg",
"operatorAccountUuid": "36c27e8ff05c4780bf6d2fa65700f22e",
"duration": 22.0,
"requestUuid": "d78093c0b2fb3850b3ce563b3a0b029d",
"responseUuid": "08cf3fd2c4614811b4acc0620e20a98e",
"sessionUuid": "05e5c663eb794faab5c5606c38103a17",
"responseDump": "{\"success\":true}",
"time": 1.512037844556E12
}
]
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.3 |
audits | List | See audits. | 2.3 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
description | String | The brief description of the error. | 0.6 |
details | String | The details about the error. | 0.6 |
elaboration | String | The reserved field. Default value: null. | 0.6 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#audits
Name | Type | Description | Starting Version |
---|---|---|---|
resourceUuid | String | The resource UUID. | 2.3 |
resourceType | String | The resource type. | 2.3 |
apiName | String | The API name. | 2.3 |
error | String | The details about the error. | 2.3 |
operatorAccountUuid | String | The UUID of the account that initiated the API. | 2.3 |
duration | long | The API duration. | 2.3 |
requestUuid | String | The API request UUID. | 2.3 |
responseUuid | String | The API response UUID. | 2.3 |
sessionUuid | String | The session UUID. | 2.3 |
requestDump | String | The JSON archive of the API request. | 2.3 |
responseDump | String | The JSON archive of the API response. | 2.3 |
time | long | The time that the record was generated. | 2.3 |
SDK Sample
Java
SDK
GetAuditDataAction action = new GetAuditDataAction();
action.startTime = 1.557300701132E12;
action.limit = 50.0;
action.conditions = asList("VMUuid=4ca37b1e21e846bf8d35b23d4138489c");
action.auditType = "Resource";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetAuditDataAction.Result res = action.call();
Python
SDK
GetAuditDataAction action = GetAuditDataAction()
action.startTime = 1.557300701178E12
action.limit = 50.0
action.conditions = [VMUuid=6623c395df0d44b6afc3732e76aac0ac]
action.auditType = "Resource"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetAuditDataAction.Result res = action.call()