latestOpenAPI 3.1.0Apache License Version 2.02026-08-17498525913.3 KB

40169ccdec5c

audit-log-controller

Get audit logs by user id (getAuditLogsByUserId)

Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See response schema for more details.

Available for users with 'TENANT_ADMIN' authority.

get/api/audit/logs/user/{userId}

Path parameters

userIdstring required

A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'

Query parameters

pageSizeinteger required

Maximum amount of entities in a one page

pageinteger required

Sequence number of page starting from 0

textSearchstring

The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus.

sortProperty'createdTime' | 'entityType' | 'entityName' | 'userName' | 'actionType' | 'actionStatus'

Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged.

sortOrder'ASC' | 'DESC'

Sort order. ASC (ASCENDING) or DESC (DESCENDING)

startTimeinteger

The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'.

endTimeinteger

The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'.

actionTypesstring

A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details.

Response

OK

totalPagesinteger

Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria

totalElementsinteger

Total number of elements in all available pages

hasNextboolean

'false' value indicates the end of the result set

Example response

{
  "data": [
    {
      "id": {
        "id": "784f394c-42b6-435a-983c-b7beff2784f9"
      },
      "createdTime": 1609459200000,
      "tenantId": {
        "id": "784f394c-42b6-435a-983c-b7beff2784f9",
        "entityType": "TENANT"
      },
      "customerId": {
        "id": "784f394c-42b6-435a-983c-b7beff2784f9",
        "entityType": "CUSTOMER"
      },
      "entityId": {
        "id": "784f394c-42b6-435a-983c-b7beff2784f9",
        "entityType": "DEVICE"
      },
      "entityName": "Thermometer",
      "userId": {
        "id": "784f394c-42b6-435a-983c-b7beff2784f9",
        "entityType": "USER"
      },
      "userName": "tenant@thingsboard.org",
      "actionType": "ADDED",
      "actionData": {},
      "actionStatus": "SUCCESS"
    }
  ]
}