Managing Permissions with Content Services
The API supports GET, POST, and DELETE calls.
All the endpoints take the "id" parameter. See above for how to correctly structure them.
Read Permissions (ACLs)
Request:
GET/repo/(connectorid)/acls?id=(id)
Description:
Retrieve a list of acls in the format ["User1:Permission1","User2:Permission2"]. The value
of users can be parsed by users in the POST and DELETE methods.
Path Parameters:
connectorid: The connector id of your content service connector
Query Parameters:
id: The repository id in the compound format used for SharePoint Online.See above.
GET repo/spo/acls?id=ad7c1901-eb58-42f9-a9eb-38210896adcd
isList: (optional, 3.1.2+): If this argument is included and set to true, supplying the list name instead of a document guid will retrieve the permissions on the list
Returns:
{
"results": [
"Dev Owners:Full Control",
"Dev Visitors:Read",
"Dev Members:Edit"
],
"success": true
}
Example With CURL
curl -u admin:admin "localhost:8081/3sixty-admin/api/repo/spo/acls?id=ad7c1901-eb58-42f9-a9eb-38210896adcd" | json_pp
Write Permissions (ACLs)
Request:
POST /repo/(connectorid)/acls?id=(id)
Description:
Adds acls to the selected document. If you wish to change an existing permission, use the DELETE method first.
Path Parameters:
connectorid: The connector id of your content service connector
POST Body: A JSON Object in the format
{"Group1":"Permission1","Group2":"Permission2"}"
Query Parameters:
id: The repository id in the compound format used for SharePoint Online. See above.
Delete Permissions (ACLs)
Request:
DELETE /repo/(connectorid)/acls?id=(id)&aclId=(aclId)
Description:
Removes a group from the permission list of the targeted document.
Path Parameters:
connectorid :The connector id of your content service connector
Query Parameters:
id: The repository id in the compound format used for SharePoint Online.See above.
aclId: Comma delimited list of names to remove
DELETE repo/spo/acls?id=ad7c1901-eb58-42f9-a9eb-38210896adcd&aclId=Dev Visitors
Returns:
{ "success": true }
A Subsequent GET call would produce
{
"results": [
"Dev Owners:Full Control",
"Dev Members:Edit"
],
"success": true
}
Example With CURL
curl -u admin:admin -X DELETE "localhost:8081/3sixty-admin/api/repo/spo/acls?id=ad7c1901-eb58-42f9-a9eb-38210896adcd&aclId=Dev%20Visitors" | json_pp
For this example the file is located at: /Shared Documents/ATandT TUV Mashup.txt
The Content Service Connection with the connector id spo is the one from the image at the beginning of the page
with Site Name set to sites/Dev and List Name set to Documents(the default alias for the Shared Documents' folder in SharePoint)
The 3Sixty instance is located at: http://localhost:8081/3sixty-admin
First, we'll need the id of the document, so we'll use ID by path. Since the document is in the root folder we'll pass "/" as the folder path.
http://localhost:8081/3sixty-admin/api/repo/spo/idbypath?folderPath=/&fileName=ATandT TUV Mashup.txt
{
"success": true,
"results": "ad7c1923-eb58-42f9-a9eb-3821089aadcd"
}
So, the call
http://localhost:8081/3sixty-admin/repo/spo/acls?id=ad7c1923-eb58-42f9-a9eb-3821089aadcd
Produces:
{
"results": [
"Dev Owners:Full Control",
"Dev Visitors:Read",
"Dev Members:Edit"
],
"success": true
}
If we want to replace Dev Members "Edit" permission with the "Full Control" permission first we call DELETE on Dev Members:
http://localhost:8081/3sixty-admin/repo/spo/acls?id=ad7c1923-eb58-42f9-a9eb-3821089aadcd&aclId=Dev Members
Then we would call the POST to add the new permission for Dev Members:
http://localhost:8081/3sixty-admin/api/repo/spo/acls?id=ad7c1923-eb58-42f9-a9eb-3821089aadcd&acls={"Dev Members":"Full Control"}
Related Articles