You can assign site-level permissions in two steps:
Step 1: Get form digest
To get the X-RequestDigest value, make a GET request to the contextinfo endpoint.
Method: POST
URI: https://<your-sharepoint-site>/_api/contextinfo
Headers:
{
"accept": "application/json;odata=verbose"
}
Use the Parse JSON action to extract the FormDigestValue from the response.
Step 2: Add the group to the site
Method: POST
URI: https://<your-sharepoint-site>/_api/web/roleassignments/addroleassignment(principalid=<GroupID>,roledefid=<RoleDefinitionID>)
Headers:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": "<Your-Request-Digest>"
}
Body is not required
Replace <GroupID> with the ID of the group you retrieved in Step 2.
Replace <RoleDefinitionID> with the appropriate permission level ID:
Read: 1073741826
Contribute: 1073741827
Full Control: 1073741829
Replace <Your-Request-Digest> with the FormDigestValue from the contextinfo endpoint
Hope that helps!