Getting the role of a user

Hi,
I want to get the role of a logged in user in my custom script using V8js. How can I proceed?

Thanks in advance.

When you make a POST or GET request to /user/session for a non-admin user it’ll return the role_id.

You can use platform.api.get(“user/session”) in your script. The role needs to allow script access for GET on /user/session.

Thanks @toddappleton. That worked.