Online sharepoint: breakRoleInheritance and addRoleAssignment do not work with the other API queries

Change breakrole inheritance endpoint from

/ _api / web / GetFolderByServerRelativeUrl (& # 39; //& # 39;) / breakroleinheritance (copyRoleAssignments = true, clearSubscopes = true)

to the next end of rest

/ _api / web / GetFolderByServerRelativeUrl (& # 39; //& # 39;) / ListItemAllFields / breakroleinheritance (copyRoleAssignments = true, clearSubscopes = true)

Also, change the resting endpoint addroleassignment from

/ _api / web / GetFolderByServerRelativeUrl (& # 39; //& # 39;) / roleassignments / addroleassignment (principalid =, roleDefId =)

to the next end of rest

/ _api / web / GetFolderByServerRelativeUrl (& # 39; //& # 39;) / ListItemAllFields / roleassignments / addroleassignment (principalid =, roleDefId =)

Files and folders rest api for SharePoint reference:

https://msdn.microsoft.com/en-us/library/office/dn450841.aspx

SharePoint REST API URL for accessing List items,documents,assign permission in list, document libraries, Search and user profile property