I am new and learning Genesys cloud and data actions on a fast pace as per the requirements.
I want to validate on my digital bot flow if the user is a supervisor, if yes, take one action if not, take another action.
have explored these APIs:
GET /api/v2/authorization/subjects/{subjectId}: Returns a listing of roles and permissions for a user.
GET /api/v2/users/{subjectId}/roles: Returns a listing of roles and permissions for a user.GET
both gives me a list of users or roles.
How do I either filter specific role to a user or specific user to a role? I believe either would work for me.
I am basing this answer on the /api/v2/authorization/subjects/me route which I had easy access to. You would have to modify this if the routes you are using give a different response shape.
I took the response from the API and put it in here (this isn't a Genesys site, so I wouldn't paste anything sensitive here):
I came up with this as the JSONPath to check if my user has the specified role name:
If my user doesn't have it, it will return an empty array. If it does have the role, the role will end up in the response. If you want a boolean out of that you could do a contains on the variable to see if the name is in it.