REST API: Add Group to Site

cancel
Showing results for 
Search instead for 
Did you mean: 
mlorentz
Member II

REST API: Add Group to Site

Jump to solution

Hi everyone,

 

In the frontend of Alfresco DMS we can add a group to a site with for example role = "SiteContributor", so therefore all users within the group has access with this specific right for the site. I wasn't able to find the endpoint in the alfresco api explorer. I looked up for /sites/:id/groups or /groups/:id/sites, but I wasn't lucky. Also I tried PUT /nodes/:id with permissions, but I can't see an effect on the frontend.

 

Do I miss something? Could you help me please?

1 Solution

Accepted Solutions
abhinavmishra14
Advanced

Re: REST API: Add Group to Site

Jump to solution

You can use this REST API to add groups to a site:

 

'shortname' is the shortname of the web site, 'authorityname' is the full authority name for the membership. Required parameters,

role, mandatory String, the new role name for this membership.

person object, with userName property

OR group object, with fullName property

OR authority object, with fullName property

The web script description document specifies the following options:
 
Value Description
json The default response format
user The authentication access
required The transaction level
argument The format style

 

Example: 

POSThttp://localhost:8080/alfresco/service/api/sites/test/memberships

'test', is a site short name.

JsonPayload:

{
  "role" : "SiteContributor",
  "group" : {
      "fullName":"GROUP_EngineeringTeam"
  }
}

Make sure you add 'GROUP_' prefix to the group name you want to add to the site.

You should be getting response something like:

{
    "role": "SiteContributor",
    "authority": {
        "authorityType": "GROUP",
        "shortName": "EngineeringTeam",
        "fullName": "GROUP_EngineeringTeam",
        "displayName": "EngineeringTeam",
        "url": "/alfresco/service/api/groups/EngineeringTeam"
    },
    "url": "/alfresco/service/api/sites/test/memberships/GROUP_EngineeringTeam"
}

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View solution in original post

2 Replies
abhinavmishra14
Advanced

Re: REST API: Add Group to Site

Jump to solution

You can use this REST API to add groups to a site:

 

'shortname' is the shortname of the web site, 'authorityname' is the full authority name for the membership. Required parameters,

role, mandatory String, the new role name for this membership.

person object, with userName property

OR group object, with fullName property

OR authority object, with fullName property

The web script description document specifies the following options:
 
Value Description
json The default response format
user The authentication access
required The transaction level
argument The format style

 

Example: 

POSThttp://localhost:8080/alfresco/service/api/sites/test/memberships

'test', is a site short name.

JsonPayload:

{
  "role" : "SiteContributor",
  "group" : {
      "fullName":"GROUP_EngineeringTeam"
  }
}

Make sure you add 'GROUP_' prefix to the group name you want to add to the site.

You should be getting response something like:

{
    "role": "SiteContributor",
    "authority": {
        "authorityType": "GROUP",
        "shortName": "EngineeringTeam",
        "fullName": "GROUP_EngineeringTeam",
        "displayName": "EngineeringTeam",
        "url": "/alfresco/service/api/groups/EngineeringTeam"
    },
    "url": "/alfresco/service/api/sites/test/memberships/GROUP_EngineeringTeam"
}

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
mlorentz
Member II

Re: REST API: Add Group to Site

Jump to solution

That's perfect, thank you so much for this example!