Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

API to get group members list.

Ajinkya Kove1
Tera Contributor

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

Amit Gujarathi
Giga Sage

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