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
| Method | Route | What it does | Delegated scope | Application roles | Rate limit | Response codes |
|---|---|---|---|---|---|---|
| GET | /admin/collab/v1/manage/spo/{group-id}/ | Reads a site | Config.ReadWrite.All | Collab.Manage.Read.All, Collab.Manage.ReadWrite.All | Read | 200, 401, 403, 404, 429 |
| PATCH | /admin/collab/v1/manage/spo/{group-id}/ | Changes the template and the policy | Config.ReadWrite.All | Collab.Manage.ReadWrite.All | Create, update, delete | 200, 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 Type | Permissions |
|---|---|
| Delegated (work or school account) | https://api.insiders.easylife365.cloud/admin/Config.ReadWrite.All |
| Application | Collab.Manage.ReadWrite.All for both routes, Collab.Manage.Read.All for the read |
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
| Header | Value |
|---|---|
| Authorization | Bearer token. (Required) |
| Content-Type | application/json |
Request body
| Property | Type | Description |
|---|---|---|
templateId | String | ID of the SharePoint site template. (Optional) |
policyId | String | ID 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
400with the codeCollab.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:
| Status | Code | When |
|---|---|---|
| 400 | Collab.TemplateNotActive | The template is not active. |
| 400 | Collab.TemplateNotApplicable | The template is not a SharePoint site template. |
| 400 | Collab.PolicyNotApplicable | The policy is not a SharePoint site policy. |
| 400 | Collab.SiteNotManaged | The group is not a SharePoint site managed by EasyLife 365. |
| 400 | Collab.ValidationFailed | The body names owners. |
| 403 | NotAllowed | The role is missing, or it is the read role on a change. |
| 404 | NotFound | The group does not exist, or it is not a site EasyLife 365 manages (on a read). |
| 404 | Collab.TemplateNotFound | The template does not exist. |
| 404 | Collab.PolicyNotFound | The 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.