Returns a list of all audit trails belonging to an account as per the specified criteria. This API is paginated and returns 10 audit trails by default. An audit trail is uniquely identified by an 'audit_trail_key'. This key should be used in all the other API referencing a particular audit trail.

Params

Param name Description
page
optional

Page number of results to be fetched, Default 1


Value: Must be Integer.
per
optional

Number of audit_trail records to be returned in one page, Default 10


Value: Must be Integer.
order_by
optional

Field on which resultant audit_trails should be sorted


Value: Must be a String
order
optional

Order, asc or desc, in which results should be sorted


Value: Must be a String
timestamp_format
optional

Format, “str” or “int”, in which timestamps should be returned, Default “int”


Value: Must be a String
search
optional

Keywords based on which audit_trails should be searched. Currently you can search audit_trails on - action_taken, entity_type, entity_name, entity_key


Value: Must be a String
scope
optional

Matching condition if multiple keywords are specified for search. Valid values are “all” or “any”. Default is “all”


Value: Must be a String
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean
entity_type
optional

The type of the object for which audit_trails are to be fetched, such as Thing, Rule


Value: Must be a String
entity_key
optional

The key of the object for which audit_trails are to be fetched


Value: Must be a String

Examples

Request - listing all audit trails without any criteria
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:6AuwD9E_WT_LEKwNOBbytg" https://api.datonis.io/api/v3/audit_trails

Response (returns first 10 records)
{
  "total_count": 8,
  "page": 1,
  "audit_trails": [
    {
      "action_taken": "create",
      "audit_trail_key": "ta6c4f6da4",
      "entity_key": "7t16794d28",
      "entity_name": "Refrigerator",
      "entity_type": "ThingTemplate",
      "new_entity_contents": {
        "created_at": 1448430440,
        "description": "Template for Refrigerators",
        "name": "Refrigerator",
        "thing_template_key": "7t16794d28",
        "updated_at": 1448430440,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK"
        },
        "metrics": [

        ]
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430440,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    },
    {
      "action_taken": "create",
      "audit_trail_key": "af7bd2dd14",
      "entity_key": "831e1tf472",
      "entity_name": "Washing Machine",
      "entity_type": "ThingTemplate",
      "new_entity_contents": {
        "created_at": 1448430440,
        "description": "Template for washing machines",
        "name": "Washing Machine",
        "thing_template_key": "831e1tf472",
        "updated_at": 1448430440,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK"
        },
        "metrics": [

        ]
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430440,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    },
    {
      "action_taken": "create",
      "audit_trail_key": "8a2fb59f27",
      "entity_key":...
Request - listing audit trails by specifying number of audit trails to be returned at a time (page size) and specific set to be returned (page)
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:6AuwD9E_WT_LEKwNOBbytg" -d '{"per":"2", "page":"2"}' https://api.datonis.io/api/v3/audit_trails

Response (returns page 2 with 2 audit trails per page)
{
  "total_count": 8,
  "page": "2",
  "audit_trails": [
    {
      "action_taken": "create",
      "audit_trail_key": "8a2fb59f27",
      "entity_key": "82e2et9c31",
      "entity_name": "Energy Meter",
      "entity_type": "ThingTemplate",
      "new_entity_contents": {
        "created_at": 1448430440,
        "description": "Template for Energy Meters",
        "name": "Energy Meter",
        "thing_template_key": "82e2et9c31",
        "updated_at": 1448430440,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK"
        },
        "metrics": [

        ]
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430440,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    },
    {
      "action_taken": "create",
      "audit_trail_key": "296ef4f7d9",
      "entity_key": "92df5df8cb",
      "entity_name": "Fully Automated Washing Machine",
      "entity_type": "Thing",
      "new_entity_contents": {
        "bi_directional": true,
        "coordinates": [
          21.15,
          79.09
        ],
        "created_at": 1448430551,
        "description": "Thing for washing machines",
        "name": "Fully Automated Washing Machine",
        "state": null,
        "tags_array": [
          "Corporate"
        ],
        "thing_key": "92df5df8cb",
        "updated_at": 1448430551,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK",
          "Installation Type": "Free Standing",
          "Manufacturer": "LG",
          "Color": "White"
     ...
Request - listing audit trails ordered by a field with string formatted timestamps
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:6AuwD9E_WT_LEKwNOBbytg" -d '{"timestamp_format":"str","order_by":"entity_name","order":"desc"}' https://api.datonis.io/api/v3/audit_trails

Response (returns audit trails in the reverse order of entity name and timestamps in string format)
{
  "total_count": 8,
  "page": 1,
  "audit_trails": [
    {
      "action_taken": "create",
      "audit_trail_key": "af7bd2dd14",
      "entity_key": "831e1tf472",
      "entity_name": "Washing Machine",
      "entity_type": "ThingTemplate",
      "new_entity_contents": {
        "created_at": 1448430440,
        "description": "Template for washing machines",
        "name": "Washing Machine",
        "thing_template_key": "831e1tf472",
        "updated_at": 1448430440,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK"
        },
        "metrics": [

        ]
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430440,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    },
    {
      "action_taken": "create",
      "audit_trail_key": "3e6672tb59",
      "entity_key": "466cd49313",
      "entity_name": "Top Fridge Refrigerator",
      "entity_type": "Thing",
      "new_entity_contents": {
        "bi_directional": false,
        "coordinates": [
          20.15,
          78.09
        ],
        "created_at": 1448430551,
        "description": "Thing for Refrigerator",
        "name": "Top Fridge Refrigerator",
        "state": null,
        "tags_array": [
          "Residencial"
        ],
        "thing_key": "466cd49313",
        "updated_at": 1448430551,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK",
          "Manufacturer": "LG",
          "Color": "Red"
        },
        "alive": false,
        "tags": "Residencial",...
Request - listing audit trails based on some search criteria with all keywords matching
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:6AuwD9E_WT_LEKwNOBbytg" -d '{"search":"Machine Full"}' https://api.datonis.io/api/v3/audit_trails

Response (returns audit trails containing both keywords 'Machine' as well as 'Full')
{
  "total_count": 1,
  "page": 1,
  "audit_trails": [
    {
      "action_taken": "create",
      "audit_trail_key": "296ef4f7d9",
      "entity_key": "92df5df8cb",
      "entity_name": "Fully Automated Washing Machine",
      "entity_type": "Thing",
      "new_entity_contents": {
        "bi_directional": true,
        "coordinates": [
          21.15,
          79.09
        ],
        "created_at": 1448430551,
        "description": "Thing for washing machines",
        "name": "Fully Automated Washing Machine",
        "state": null,
        "tags_array": [
          "Corporate"
        ],
        "thing_key": "92df5df8cb",
        "updated_at": 1448430551,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK",
          "Installation Type": "Free Standing",
          "Manufacturer": "LG",
          "Color": "White"
        },
        "alive": false,
        "tags": "Corporate",
        "last_event": null,
        "last_beat": null,
        "thing_template_name": "Washing Machine",
        "thing_template_key": "831e1tf472"
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430551,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    }
  ]
}
Request - listing audit trails based on some search criteria with any of the keywords matching
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:6AuwD9E_WT_LEKwNOBbytg" -d '{"search":"Machine Full","scope":"any"}' https://api.datonis.io/api/v3/audit_trails

Response (returns audit trails containing either of the keywords 'Machine' or 'Full')
{
  "total_count": 3,
  "page": 1,
  "audit_trails": [
    {
      "action_taken": "create",
      "audit_trail_key": "af7bd2dd14",
      "entity_key": "831e1tf472",
      "entity_name": "Washing Machine",
      "entity_type": "ThingTemplate",
      "new_entity_contents": {
        "created_at": 1448430440,
        "description": "Template for washing machines",
        "name": "Washing Machine",
        "thing_template_key": "831e1tf472",
        "updated_at": 1448430440,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK"
        },
        "metrics": [

        ]
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430440,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    },
    {
      "action_taken": "create",
      "audit_trail_key": "296ef4f7d9",
      "entity_key": "92df5df8cb",
      "entity_name": "Fully Automated Washing Machine",
      "entity_type": "Thing",
      "new_entity_contents": {
        "bi_directional": true,
        "coordinates": [
          21.15,
          79.09
        ],
        "created_at": 1448430551,
        "description": "Thing for washing machines",
        "name": "Fully Automated Washing Machine",
        "state": null,
        "tags_array": [
          "Corporate"
        ],
        "thing_key": "92df5df8cb",
        "updated_at": 1448430551,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK",
          "Installation Type": "Free Standing",
          "Manufacturer": "LG",
          "Color": "White"
        },
        "alive": false,
        "tags": "Corporate",
        "last_event": null,
        "last_beat": null,
        "thing_template_name": "Washing Machine",
        "thing_template_key": "831e1tf472"
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430551,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    },
    {
      "action_taken": "create",
      "audit_trail_key": "ebf7371ac9",
      "entity_key": "ta597t738b",
      "entity_name": "Semi Automated Washing Machine",
      "entity_type": "Thing",
      "new_entity_contents": {
        "bi_directional": false,
        "coordinates": [
          20.15,
          78.09
        ],
        "created_at": 1448430551,
        "description": "Thing for washing machines",
        "name": "Semi Automated Washing Machine",
        "state": null,
        "tags_array": [
          "Residencial"
        ],
        "thing_key": "ta597t738b",
        "updated_at": 1448430551,
   ...
Request - listing audit trails based on entity key and entity type specified
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:6AuwD9E_WT_LEKwNOBbytg" -d '{"entity_key":"831e1tf472", "entity_type":"ThingTemplate"}' https://api.datonis.io/api/v3/audit_trails

Response (returns audit trails matching the entity key and entity type specified)
{
  "total_count": 1,
  "page": 1,
  "audit_trails": [
    {
      "action_taken": "create",
      "audit_trail_key": "af7bd2dd14",
      "entity_key": "831e1tf472",
      "entity_name": "Washing Machine",
      "entity_type": "ThingTemplate",
      "new_entity_contents": {
        "created_at": 1448430440,
        "description": "Template for washing machines",
        "name": "Washing Machine",
        "thing_template_key": "831e1tf472",
        "updated_at": 1448430440,
        "user_defined_properties": {
          "Firmware Ver": "1.0",
          "STATE": "OK"
        },
        "metrics": [

        ]
      },
      "old_entity_contents": {
      },
      "timestamp": 1448430440,
      "user_name": "Aboli Mahajan",
      "datonis_role_name": "Account Admin"
    }
  ]
}