Skip to main content
Version: Insiders

Manage SharePoint Site Templates and Policies

The EasyLife 365 Collaboration Insiders API reads the SharePoint sites that EasyLife 365 manages and changes their templates and policies. The changes apply to the EasyLife 365 security group that belongs to the site. You can call it as a signed-in administrator or as an application. For the application setup, see Call the API as an application.

Routes​

MethodRouteWhat it doesDelegated scopeApplication rolesRate limitResponse codes
GET/admin/collab/v1/manage/spo/{group-id}/Reads a siteConfig.ReadWrite.AllCollab.Manage.Read.All, Collab.Manage.ReadWrite.AllRead200, 401, 403, 404, 429
PATCH/admin/collab/v1/manage/spo/{group-id}/Changes the template and the policyConfig.ReadWrite.AllCollab.Manage.ReadWrite.AllCreate, update, delete200, 400, 401, 403, 404, 429

{group-id} is the object ID of the EasyLife 365 security group that belongs to the site, not the ID of the site.

Permissions​

Permission TypePermissions
Delegated (work or school account)https://api.insiders.easylife365.cloud/admin/Config.ReadWrite.All
ApplicationCollab.Manage.ReadWrite.All for both routes, Collab.Manage.Read.All for the read
note

Collab.Manage.Read.All can read a site. It cannot change one: a PATCH answers 403. Application permissions always require admin consent. A role of another product does not work here. See Call the API as an application.

Read a site​

GET https://api.insiders.easylife365.cloud/admin/collab/v1/manage/spo/{group-id}/
Authorization: Bearer {access-token}

Response​

{
"id": "b5967fe9-fc1b-4415-9103-04694c79a758",
"displayName": "SG_EL_SPO_cc99d8a0_bb8d_4784_9ff6_841623e4458b",
"isCompliant": true,
"metadata": {
"tId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b"
},
"policy": {
"pId": "ad869549-d693-4d20-8879-402d5ed3d991"
},
"schema": {
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"policyId": "ad869549-d693-4d20-8879-402d5ed3d991",
"isCompliant": true,
"extensionAttribute1": "cc99d8a0-bb8d-4784-9ff6-841623e4458b",
"extensionAttribute3": "https://contoso.sharepoint.com/sites/aurora"
}
}

metadata, policy and schema are the data EasyLife 365 stores on the site, returned as stored. Their inner names carry no promise to stay the same, so read only the names you need. See What a read returns.

A group that is not a SharePoint site managed by EasyLife 365 answers 404 on the read and 400 on the change.

Change a site​

PATCH https://api.insiders.easylife365.cloud/admin/collab/v1/manage/spo/{group-id}/
Content-Type: application/json

HTTP request headers​

HeaderValue
AuthorizationBearer token. (Required)
Content-Typeapplication/json

Request body​

PropertyTypeDescription
templateIdStringID of the SharePoint site template. (Optional)
policyIdStringID of the SharePoint site policy. (Optional)
  • All values are optional. A value you leave out is not changed.
  • To assign a template and a policy, send both values.
  • To clear a value, for example to remove a policy, send "00000000-0000-0000-0000-000000000000".
  • Owners cannot be changed with this call. A body with owner values answers 400 with the code Collab.ValidationFailed.

Response​

A successful call answers 200 with the site after the change, with the same members as the read.

Errors​

Errors are application/problem+json with code, title, detail and requestId. The list of codes is on Call the API as an application. These are the ones you can expect here:

StatusCodeWhen
400Collab.TemplateNotActiveThe template is not active.
400Collab.TemplateNotApplicableThe template is not a SharePoint site template.
400Collab.PolicyNotApplicableThe policy is not a SharePoint site policy.
400Collab.SiteNotManagedThe group is not a SharePoint site managed by EasyLife 365.
400Collab.ValidationFailedThe body names owners.
403NotAllowedThe role is missing, or it is the read role on a change.
404NotFoundThe group does not exist, or it is not a site EasyLife 365 manages (on a read).
404Collab.TemplateNotFoundThe template does not exist.
404Collab.PolicyNotFoundThe policy does not exist.
{
"type": "https://docs.easylife365.cloud/errors/collab/template-not-active",
"title": "The template is not active or not valid.",
"status": 400,
"detail": "Template with Id fc6ffbd8-f7f0-4c05-b707-227d233b9e1b is not active",
"code": "Collab.TemplateNotActive",
"requestId": "0HNG2K4V7QJ3D:0000000C"
}

Example 1: Assign a template and a policy to a site​

PATCH https://api.insiders.easylife365.cloud/admin/collab/v1/manage/spo/b5967fe9-fc1b-4415-9103-04694c79a758/
Content-Type: application/json
{
"templateId": "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b",
"policyId": "ad869549-d693-4d20-8879-402d5ed3d991"
}

Example 2: Clear the policy of a site​

{
"policyId": "00000000-0000-0000-0000-000000000000"
}

Example 3: Read a site as an application (curl)​

curl "https://api.easylife365.cloud/admin/collab/v1/manage/spo/b5967fe9-fc1b-4415-9103-04694c79a758/" \
-H "Authorization: Bearer $ACCESS_TOKEN"

Example 4: Change a site as an application (PowerShell)​

Get the token as shown in Call the API as an application and keep it in $accessToken.

$uri = "https://api.easylife365.cloud/admin/collab/v1/manage/spo/b5967fe9-fc1b-4415-9103-04694c79a758/"

$body = @{
templateId = "fc6ffbd8-f7f0-4c05-b707-227d233b9e1b"
policyId = "ad869549-d693-4d20-8879-402d5ed3d991"
} | ConvertTo-Json

$headers = @{ Authorization = "Bearer $accessToken" }

Invoke-RestMethod -Method Patch -Uri $uri -Headers $headers -ContentType "application/json" -Body $body

On the Insiders ring, use the host api.insiders.easylife365.cloud.