Yes, it is possible to use the Portals Web API to retrieve all contacts who have the "Administrators" role.
In Dataverse, the relationship between contacts and web roles is represented by a many-to-many relationship using an intermediate table: contactroles_association
.
The base URL for the Portals Web API: - https://yourportalurl/_api/contacts
Use $filter
and $expand
to get contacts with the "Administrators" role: - GET https://yourportalurl/_api/contacts?$expand=contactroles_association($filter=webroleid eq 'WebRoleIDForAdministrators')
Go to Portals Management App. Navigate to Web Roles and locate the "Administrators" role. Copy the GUID of the "Administrators" role (e.g., b1234567-89ab-cdef-0123-456789abcdef
).
If the GUID for the "Administrators" role is b1234567-89ab-cdef-0123-456789abcdef
, the API call - GET https://yourportalurl/_api/contacts?$expand=contactroles_association($filter=webroleid eq 'b1234567-89ab-cdef-0123-456789abcdef')
Check whether Web API enabled or not
Navigate to Power Platform Admin Center > Portals > Settings. Enable Portals Web API.
Set appropriate permissions for the Contact
table: Navigate to Portals Management App > Entity Permissions. Create or update permissions for the Contact
table to allow Read access for the required web roles.
now test API with postman - hope this helps.