Use the following APIs to get audit logs, get audit types, and get entity types.

Required Permissions

You must have the View Audit Logs permission to perform these operations.

Get Audit Logs

API
/api/audit-logs
Method
GET
Required Parameters
None
Sample Response
{
"audits": [
            {
                  "id": "5bbdecdc07c1c851a0a73491",
                  "entityId": "1234567890abcef1234567890abcef",
                  "entityType": "DEVICE",
                  "auditType": "ENTITY_CREATED",
                  "auditInformation": "Entity created with some information",
                  "createdTime": 1541843929120,
                  "deviceId": "5be5845cd7c65c0001e48c90"
            },
            {
                  "id": "5bbdecdc07c1c851a0a73492",
                  "entityId": "1234567890abcef1234567890abcef",
                  "entityType": "DEVICE",
                  "auditType": "ENTITY_DELETED",
                  "createdTime": 1541867890431,
                  "deviceId": "5be5845cd7c65c0001e48c90"
            }
         ],
         "page": {
         "number": 1,
         "size": 10,
         "totalElements": "2",
         "totalPages": "1"
         }
}

Get Audit Types

API
/api/audit/audit-types
Method
GET
Required Parameters
None
Sample Response
{
"auditTypes": [
   "ENTITY_CREATED",
   "ENTITY_DELETED",
   "ENTITY_UPDATED",
   "ENTITY_ENROLLED",
   "ENTITY_UNENROLLED",
   "AGENT_CLIENT_CONNECTED",
   "AGENT_CLIENT_DISCONNECTED"
]
}

Get Entity Types

API
/api/entity-types
Method
GET
Required Parameters
None
Sample Response
{
   "entityTypes": [
      "ALERT",
      "ALERT_DEFINITION",
      "CALLBACK",
      "DEVICE",
      "DEVICE_TEMPLATE",
      "FILTER_DEFINITION",
      "GREETING",
      "GROUP",
      "NOTIFICATION_DESTINATION",
      "NOTIFICATION_DEFINITION",
      "NOTIFICATION_INSTANCE",
      "ROLE",
      "TENANT",
      "USER",
      "CAMPAIGN"
   ]
}

Export Audit Logs in CSV Format

API
/api/audit-logs/export
Method
GET
Headers
Content-Type: application/json
Accept: text/csv;api-version=<api-version>
Optional Parameters
Name Description
startTime Start time in epoch format in milliseconds. For example: 1557930540000
endTime End time in epoch format in milliseconds.
Sample Response
traceId,nodeName,lastUpdatedBy,instanceName,updateVersion,entityType,entityId,auditType,expireAt,deviceId,userId,orgId,createdBy,createdTime,lastUpdatedTime,id,auditInformation
bd45a6664f5ecaf5dab3d91cc0ca2ca9,iotc-node-1,5a906597-4c18-4d7a-ac1d-4e13c49757c3,default,1,DEVICE,5a906597-4c18-4d7a-ac1d-4e13c49757c3,ENTITY_UPDATED,1561538879315,5a906597-4c18-4d7a-ac1d-4e13c49757c3,5a906597-4c18-4d7a-ac1d-4e13c49757c3,e3f0187b-a435-4236-a61f-11a515ae95a3,5a906597-4c18-4d7a-ac1d-4e13c49757c3,1558946879315,1558946879315,4e0499a4-9486-4af5-8996-dc5566dc8b04,System property updated.
87277e6db5952709955dc0f31d4226fb,iotc-node-1,5a906597-4c18-4d7a-ac1d-4e13c49757c3,default,1,DEVICE,5a906597-4c18-4d7a-ac1d-4e13c49757c3,ENTITY_ENROLLED,1561538876023,5a906597-4c18-4d7a-ac1d-4e13c49757c3,5a906597-4c18-4d7a-ac1d-4e13c49757c3,e3f0187b-a435-4236-a61f-11a515ae95a3,5a906597-4c18-4d7a-ac1d-4e13c49757c3,1558946876023,1558946876023,319b1dc1-6619-4ce8-967d-1d47609c3345,Agent_x86 GATEWAY device enrolled.