Is there a way to get role_id

current we can get roles from the api, but it’s by names, is there any way to get role_id instead?

use case being update user roles by adding new roles.
in the roles set api, has to use role_id, but we cannot get the role_ids of the user’s current roles, only the role names, which cannot be used to update the roles.

Hey there @andyql !

Which endpoint are you using currently to get roles and which are you looking to use to assign new roles to users? I just want to make sure I am on the same page :slight_smile:

thx @tyf

two apis return same results:

  • event.authorization.roles
  • iirc users/${userId}/roles

they both give you eg ‘admin’ or ‘user’, instead of <admin_id> which you use to assgin the roles.

1 Like

Thanks for confirming!

In looking at users/${userId}/roles the role id should be returned - Here’s an example of what I’m seeing:

    "id": "rol_9bRdc5NZmfrghayE04",
    "name": "admin",
    "description": "admin role for go_api_server"
    "id": "rol_qT4pcK3345HbCJ05t",
    "name": "newUser",
    "description": "newUser"
    "id": "rol_bJ7P72pauDr454xsqN",
    "name": "org_role666",
    "description": "role only assigned at org level"
1 Like

that’s great! tested working. i must be using a different api. tyvm!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.