I haven't tested these examples -- I simply copied and pasted directly from HubSpot API docs. Sometimes the examples supplied by HubSpot don't work, so you might need to perform a little trial and error.
I hope that proves helpful. Please let me know if you have any questions.
All the best,
Zach
--
Zach Klein HubSpot Integrations & App Developer Meanjin / Brisbane, Australia
It's possible to retrieve the "Permission Set(s)" assigned to individual HubSpot Users via API. The User property that stores this data is "hs_assigned_permission_sets". For example, when retrieving an individual HubSpot User:
The "hs_assigned_permission_sets" property contains User Permission Set (or "Role") IDs. You can match up your HubSpot Portal's Permission Set IDs and Labels via the following call:
Thank you very much for your response, that approach could help, just for curiosity, do you know if there is a way to do it using the SDK? I mean using some component of the "
@hubspot/ui-extensions"... currently using the SDK, so maybe could avoid the api requests 😅
I haven't tested these examples -- I simply copied and pasted directly from HubSpot API docs. Sometimes the examples supplied by HubSpot don't work, so you might need to perform a little trial and error.
I hope that proves helpful. Please let me know if you have any questions.
All the best,
Zach
--
Zach Klein HubSpot Integrations & App Developer Meanjin / Brisbane, Australia
hubspotClient.settings.users.usersApi.getById(userId) api to get the "user role id (here the role id is the permission set id the user has and only one is possible),then get all the "roles" (permissions sets) using
hubspotClient.settings.users.rolesApi.getAll() api. Finally, check if the roleId the user has match with some role in the roles list (to gets its name).