API to get group members list.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2023 02:25 AM
How can I create an API?
I have a users group, now I have to get the list of members in that group.
How can I do it?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2023 03:53 AM
HI @Ajinkya Kove1 ,
I trust you are doing great.
No need to create any API as the relation belween group and user is saved in a table called "sys_user_grmember".
You can simply expose the API from REST API EXPLORER.
The API will be comething like given below :
var groupSysId = 'GROUP_SYS_ID'; // Replace with the Sys ID of the desired group
var apiUrl = '/api/now/table/sys_user_grmember?sysparm_query=group=' + groupSysId;
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi