web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Use webapi to get all ...
Power Pages
Suggested Answer

Use webapi to get all contacts who have "Administrators" role

(0) ShareShare
ReportReport
Posted on by 25
Hello everyone,
 
is it possible to use portals webapi to get all contacts who have "Administrators" role from contact table and how to do it?

Thanks in advance
Categories:
  • Suggested answer
    SaiRT14 Profile Picture
    1,992 Super User 2025 Season 1 on at
     
    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.
  • Suggested answer
    CU31070723-0 Profile Picture
    25 on at
    Hi SaiRT14,
     
     thanks a lot for your instructions! It didn't work for me (maybe because I'm using enhanced data model?) but using your instructions, I tried something else and came to a solution using this url:
     
    https://yourportalurl/_api/contacts?$select=fullname&$expand=powerpagecomponent_mspp_webrole_contact($filter=name eq 'Administrators')
     
    I had to set a table permission and Webapi site settings for "Site Component" table too.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
M Bilal Khan Profile Picture

M Bilal Khan 139

#2
Mohsin Ali Profile Picture

Mohsin Ali 41

#3
11manish Profile Picture

11manish 21 Super User 2026 Season 2

Last 30 days Overall leaderboard