Skip to main content
Cadet | Tier 2
March 15, 2022
Question

Audit Log API Request - Empty Response

  • March 15, 2022
  • 1 reply
  • 133 views

Hi everyone,

 

I'm trying to use the <my_control_room_url>/v1/audit/messages/list API to get information from our audit log, but I don't get a proper response.

This is how my python code looks like:

 

---------------------------------------------------------------------------------------------------

audit_url = "<my_control_room_url>/v1/audit/messages/list"

headers = {

'accept': 'application/json',

'X-Authorization': <my_access_tokenl>,

'Content-Type': 'application/json',

}

 

data = '{ "username": "myusername", "password": "mypassword"}'

 

response = requests.post(audit_url, headers=headers, data=data)

---------------------------------------------------------------------------------------------------

 

And this is what I get as a response from the server:

 

---------------------------------------------------------------------------------------------------

Status code: 200

{

 "page": {

  "offset": 0,

  "total": 227189,

  "totalFilter": 10000

 },

 "list": []

}

---------------------------------------------------------------------------------------------------

 

Why is the list empty? I also tried setting filter in the body request as shown in the swagger documentation, but the list remains empty. What am I doing wrong?

 

If someone could give me any tips, I'd appreciate it.

 

Thanks!


http://deasitdco1517.asv.local/v1/audit/messages/list

    1 reply

    Automation Anywhere Team
    July 3, 2022

    Hello,

     

    I request you to please use below request body in the code and check if you are getting the correct result:-

     

    {

    "sort": [

    {

    "field": "createdOn",

    "direction": "desc"

    }

    ],

    "filter": {

    "operator": "and",

    "operands": [

    {

    "operator": "gt",

    "field": "createdOn",

    "value": "2019-12-01T00:00:00.001Z"

    },

    {

    "operator": "lt",

    "field": "createdOn",

    "value": "2019-12-31T23:59:59.999Z"

    },

    {

    "operator": "eq",

    "field": "status",

    "value": "Unsuccessful"

    },

    {

    "operator": "substring",

    "field": "activityType",

    "value": "LOGIN"

    },

    {

    "operator": "substring",

    "field": "userName",

    "value": "joe.typical@myemiil.com"

    }

    ]

    },

    "fields": [],

    "page": {

    "length": "1000",

    "offset": "0"

    }

    }

     

    Please check below article for the same:-

     

    https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/control-room/control-room-api/cloud-api-audit-api-fetch-audit-data.html/p>

     

    Thank you,

    Prabhakar Jha

    Automation Anywhere