set file permission rest api

Showing results for 
Search instead for 
Did you mean: 
Active Member

set file permission rest api

Dear Friends

How can I set  read write permissions to file or node with alfresco REST API for individual users?

4 Replies
Established Member

Re: set file permission rest api


check this post:  

I hope this will be helpful.


Re: set file permission rest api

The best way to understand the REST API is to take a look at the API Explorer.

In this case, you'll find out that you can set local permissions by using the update node API.

Active Member

Re: set file permission rest api

Hello Alfresco Community,


I'm using alfresco-sdk-client (developed byJean Marie Pascal and Gavin Cornwell).

I set successfully permission on file, but I can not return permission object in Response object

My code:

List<PermissionElementRepresentation> users = new ArrayList<PermissionElementRepresentation>();
PermissionElementRepresentation user = new PermissionElementRepresentation();

PermissionsBodyUpdate permission = new PermissionsBodyUpdate(false, users);
NodeBodyUpdate permissionRequest = new NodeBodyUpdate(permission);

Response<NodeRepresentation> permissionResponse = nodeService.updateNodeCall(createdNodeResponse.body().getId(), permissionRequest)

But in permissionResponse object the permission object is null

Please Help me

Active Member

Re: set file permission rest api

I successfully resolve this problem:

I add two arguments IncludeParam and FieldsParam to nodeService.updateNodeCall function and get expected result:

List<String> fieldPermission = new ArrayList<>();
IncludeParam fieldValues = new IncludeParam(fieldPermission);
FieldsParam field = new FieldsParam(fieldPermission);
Response<NodeRepresentation> permissionResponse = nodeService.updateNodeCall(createdNodeResponse.body().getId(), permissionRequest, fieldValues, field)

Assert.assertEquals(permissionResponse.body().getPermissions().getLocallySet(), users, "Permission is wrong");

Thanks All