I'm trying to use the REST API in SharePoint 2013 to get the site groups.

I've been using this link for a little help... http://msdn.microsoft.com/en-us/library/jj245927.aspx

It's to do it with the Client Object Model and the REST API, I have tried both. The problem is that when I call to get Site Groups, with any of the below example urls (or using the JSOM) I seem to get every group in the whole site collection. Not just those specific to the site (SPWeb).

// I expect to get the groups in the root SPWeb


I expect to get the groups in the SPWeb at <subsite>/<subsite2>, but I get the same result as the above call.


The extra groups I am seeing are actually in subsite2, but even when I change to subsite/subsite3, I still get the same result?

It's like they are cached calls or something...is there something I am missing?? Is this call related to the calling user at all?

The server side object model does not have this problem and works as expected.

  • Funny how the reason pops up once you write it down! SiteGroups is not the same as Groups. However I cant seem to get Groups on the JSOM. Any ideas?
    – SteveCl
    Oct 24, 2013 at 17:04
  • Yes. SiteGroups will give you all the groups from the Site Collection. msdn.microsoft.com/EN-US/library/jj246603.aspx Oct 27, 2013 at 22:15
  • But is there a way (in the REST api or JSOM) to get the groups associated with a specific SPWeb? I can only think of doing something with Associations and Binding in some crazy loops!!?
    – SteveCl
    Oct 29, 2013 at 13:15
  • hi @Eric , can you please tell how can i pass a group name which starts with or contains keyword in the method getgroups?in C#, SSOM, its available , but in JSOM/ REST is it possible to achieve ?
    – samolpp2
    Dec 22, 2016 at 8:12

2 Answers 2


Even though Web class does not expose Groups property like SPWeb class does, you could still retrieve a collection that contains all the groups for the website.

How to retrieve groups for a web

Use RoleAssignmentCollection.Groups property to get the groups that directly belong to the access control list (ACL). for this securable object.


using (var ctx = new ClientContext(url))
    var web = ctx.Web;
    var webGroups = web.RoleAssignments.Groups;


  • 1
    Nice that you can use this on any securable object!
    – John-M
    Aug 26, 2014 at 20:56
  • how to export these spgroups into a csv file or excel ?
    – samolpp2
    May 31, 2017 at 9:58

With REST you can filter based on the Title of the groups. However this depends on group names containing the site name. Naming should also be consistent e.g. starting all group names with site name. The url for such a request would be

http://{sitecollection}/_api/web/sitegroups?$filter=startswith(Title,'site name') eq true

For more information about filtering take a look at http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#45_Filter_System_Query_Option_filter

  • Thanks. That doesn't really give me the groups associated with a site, just a filter on group names. Like you said, it depends 100% on the site name in the group name, which rather pigeon holes that group.
    – SteveCl
    Dec 17, 2013 at 15:49
  • dead link on there Jan 11, 2017 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.