Group by through rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017 11:26 PM
Is it possible to achieve group by functionality through REST API ? I need to fetch user names grouped by group names . I have tried
And also
But both does not work ??
Is there a provison to do this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2017 11:40 PM
Hi Vidya,
Try this
api/now/table/sys_user_grmember?sysparm_query=GROUPBYgroup.name&sysparm_fields=group.name,user.user_name
also check web service role mapped to user account which you are trying to access above REST API.
Hit like, Helpful or Correct depending on the impact of the response
Regards
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2017 12:39 AM
Hey thanks prashant that works ! but i am getting the response as follows :
{
"result": [{
"group.name": "CAB Approval",
"user.user_name": "ron.kettering"
},{
"group.name": "CAB Approval",
"user.user_name": "howard.johnson"
}] }
Is it possible to transform it into
{
"result": [
{
"CAB Approval" :
[{"user.user_name": "ron.kettering"},{"user.user_name": "howard.johnson"}]
}
] }