Get user role (admin, co-admin, user) from Python SDK
AnsweredI am trying to get the user role via the Python SDK. My use case is that I need to identify the admin user, and any co-admins. Using the standard user().get() approach, I get all of the users information, but role is not included in that. I have read in a couple of places that the type field should indicate the users role, but for verified admin and co-admin accounts, it simply says 'user'.
Is there a way to see what role the retrieved user has (admin, co-admin, user)?
-
The `role` field is not returned from the API by default; if you want to request it, you can do so using the `fields` parameter of `get()` like this:
client.user().get(fields=['id', 'name', 'login', 'role'])
Note that when you specify fields, you will need to specify every field you need. If you just specify `role`, you won't get any of the normal user fields back from the API.
Please sign in to leave a comment.
Comments
2 comments