Genesys Cloud Developer Forum

Not able to access Create audit query execution API

Hello,
I am trying to Create audit query execution using POST /api/v2/audits/query.
Request Body:

{
   "interval": "2020-08-25T00:00:00/2020-08-25T23:59:59",
   "serviceName": "ContactCenter",
   "filters": [
      {
         "property": "EntityType",
         "value": "Recycle"
      }
   ],
   "sort": [
      {
         "name": "Timestamp",
         "sortOrder": "ascending"
      }
   ]
}

Response:
{
"message": "Unable to perform the requested action. You are missing the following permission(s): [audits:audit:view]",
"code": "missing.permissions",
"status": 403
}

When I checked my roles and permission I couldn't find "audits:audit:view" permission in the list. I could see authorization:audit:view, documents:audit:view, and outbound:audit:view. I have access on all of these.

Can you please let me know if I am missing anything?

Hi Pratik,

The audits:audit:view permission needs to be added to the role your OAuth client has been assigned. Even though you have those other permissions, the audits:audit:view is required for this call and is different then the other permissions

What I would do is if you have admin access, lookup the role to your OAuth client and then look at the permissions assigned to the role. If the permission is not assigned to the role add it and that should then work.

If you do not have admin, access you will need to ask your Genesys Cloud administrator to add it. Please let me know if this helped or you have other questions.

Thanks
John

Hi John,
Thanks for the quick reply.
I do have Admin access. I forgot to mention that I am performing above task using PureCloud Developer Tools.
I checked and looks like Developer tools use Some default OAuth which I do not see in my Org's OAuth List.

Hi Prakit,

I need to check with the engineering team, but I suspect the Developers Tools Oauth client has limited access. I would recommend trying it with your own OAuth Client in your own org and see if that resolves the issue.. In the meantime, I am going to chat with our engineering lead for our Developer tools to better understand what the OAuth client for the tools can do.

Thanks,
John

Okay john, I will try from Postman and will share result with you.

Hi John,
Just to update, the API worked with custom OAuth.
Thanks for the help.

Excellent glad that worked.

Thanks,
John