This is a quick tip that will show you how to create a SharePoint Group automatically in PowerAutomate using the REST service. 

As everybody knows, the anatomy of a request REST consists of 4 parts:

  1. The endpoint
  2. The method
  3. The headers
  4. The body

List creation request using SP REST API

The endpoint : 

as you can see below in the following URL, it's divided into 2 parts, the first part consist of the url of your SharePoint site, while the second part is the uri where all the site's groups are located
[You Site]/sites/SiteName/_api/web/SiteGroups

The method : 

Since we want to create a group, the method will be POST

The headers : 

{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose"
}

The body : 

{
"__metadata":{"type":"SP.Group"},
"Title" : "Group Name",
"Description" : "A random description for this SP Group",
"OnlyAllowMembersViewMembership" : false
}

OnlyAllowMembersViewMembership : this property is to set the visibility of the members of the group as a public (all the site users can view the members) or a private (only the members of the same group has the permission to view membership)

The final result :