Skip to content

Commit 66a48c1

Browse files
committed
Updated communication site creation
1 parent 4cd9c82 commit 66a48c1

File tree

1 file changed

+65
-54
lines changed

1 file changed

+65
-54
lines changed

docs/apis/communication-site-creation-rest.md

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,105 @@
11
---
2-
title: Create SharePoint Communication site using REST
3-
description: Create and get the status of a new modern SharePoint Communication site by using the REST interface.
2+
title: Create Modern SharePoint Sites using REST
3+
description: Create and get the status of a new modern SharePoint site by using the REST interface.
44
ms.date: 4/19/2018
55
ms.prod: sharepoint
66
localization_priority: Priority
77
---
88

9-
# Create SharePoint Communication site using REST
9+
# Manage modern SharePoint sites using REST
1010

1111
This topic assumes that you are already familiar with the following topics:
1212

1313
- [Get to know the SharePoint REST service](../sp-add-ins/get-to-know-the-sharepoint-rest-service.md)
1414
- [Complete basic operations using SharePoint REST endpoints](../sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints.md)
1515

16-
This topic does not provide code snippets.
16+
This topic does not provide code snippets. The REST examples below assume an HTTP Accept header of 'application/json;odata.metadata=none'.
1717

1818
The following REST commands are available for creating a modern SharePoint Communication site:
1919

20-
- **Create**. Create a new SharePoint Communication site.
21-
- **Status**. Get the status of a SharePoint Communication site.
20+
- **Create**. Create a new SharePoint site.
21+
- **Delete**. Deletes a SharePoint site.
22+
- **Status**. Get the status of a SharePoint site.
2223

23-
The URL for Communication site REST commands is based on `_api/sitepages/communicationsite`. For example, these are the endpoints for the REST commands listed earlier:
24+
The base URL for the REST commands is `_api/SPSiteManager`.
2425

25-
- `http:///_api/sitepages/communicationsite/create`
26-
- `http:///_api/sitepages/communicationsite/status`
26+
## Create a modern site
2727

28-
## Create Communication site
28+
Using the following REST api you can create both Communication sites and non-group associated Team Sites.
29+
30+
To specify which type of site to create you use the WebTemplate attribute. Use one of the following templates to select which type of site to create:
31+
32+
* Communication Site: `SITEPAGEPUBLISHING#0`
33+
* non-group associated Team Site: `STS#3`
2934

3035
```json
31-
url: /_api/sitepages/communicationsite/create
36+
url: /_api/SPSiteManager/create
37+
accept: application/json;odata.metadata=none
38+
odata-version: 4.0
3239
method: POST
3340
body:
3441
{
35-
"request":{
36-
"__metadata":{
37-
"type":"SP.Publishing.CommunicationSiteCreationRequest"
38-
},
39-
"AllowFileSharingForGuestUsers":false,
40-
"Classification":"LBI",
41-
"Description":"Description",
42-
"SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767",
43-
"Title":"Comm Site 1",
44-
"Url":"https://vesku.sharepoint.com/sites/commsite132",
45-
"lcid":1033
46-
}
42+
"Title": "Communication Site 1",
43+
"Url":"https://contoso.sharepoint.com/sites/commsite1",
44+
"Lcid": 1033,
45+
"ShareByEmailEnabled":false,
46+
"Classification":"Low Business Impact",
47+
"Description":"Description",
48+
"WebTemplate":"SITEPAGEPUBLISHING#0",
49+
"SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767",
50+
4751
}
4852
```
4953

5054
> [!IMPORTANT]
51-
> The `lcid` parameter is not currently supported with this API. You can currently only create English sites.
55+
> If you use an app-only context to create the site collection the **owner property is required**. In other cases this is an optional property and will default to the user calling the REST endpoint.
5256
53-
New in this API is the concept of `SiteDesignID`. Much like the in-product site creation flow, the `SiteDesignID` parameter maps to the included site designs. They are:
57+
58+
The site design id can be retrieved by using the [Get-SPOSiteDesign](/powershell/module/sharepoint-online/get-spositedesign) (Microsoft SharePoint Online Management Shell) or [Get-PnPSiteDesign](/powershell/module/sharepoint-pnp/get-pnpsitedesign) (PnP PowerShell) cmdlets. If you want to apply an out-of-the-box available site design, use the following values:
5459

5560
- Topic: null
56-
- Showcase: 6142d2a0-63a5-4ba0-aede-d9fefca2c767
57-
- Blank: f6cc5403-0d63-442e-96c0-285923709ffc
61+
- Showcase: `6142d2a0-63a5-4ba0-aede-d9fefca2c767`
62+
- Blank: `f6cc5403-0d63-442e-96c0-285923709ffc`
5863

5964
### Response
6065

6166
If successful, this method returns a `200, OK` response code and simple JSON object in the response body with the following details.
6267

6368
```json
6469
{
65-
"d":{
66-
"Create":{
67-
"__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"},
68-
"SiteStatus":2,
69-
"SiteUrl":"https://contoso.sharepoint.com/sites/comm1"
70-
}
71-
}
70+
"SiteId":"d11e59ca-1465-424c-be90-c847ba849af5",
71+
"SiteStatus":2,
72+
"SiteUrl":"https://contoso.sharepoint.com/sites/commsite1"
73+
}
74+
```
75+
76+
## Delete a modern site
77+
78+
The REST API to delete a modern site is:
79+
80+
```json
81+
url: /_api/SPSiteManager/delete
82+
method: POST
83+
accept: application/json;odata.metadata=none
84+
odata-version: 4.0
85+
body:
86+
{
87+
"siteId":"d11e59ca-1465-424c-be90-c847ba849af5"
7288
}
7389
```
90+
### Response
7491

92+
If succesfull this method returns a `200, OK` response code.
7593

76-
## Get Communication site status
94+
## Get modern site status
7795

78-
The REST API for getting the status of a modern SharePoint Communication site:
96+
The REST API for getting the status of a modern SharePoint site:
7997

8098
```json
81-
url: /_api/sitepages/communicationsite/status?url='https%3A%2F%2Fcontoso.sharepoint.com%2Fsites%2Fcomm1'
99+
url: /_api/SPSiteManager/status?url='https%3A%2F%2Fcontoso.sharepoint.com%2Fsites%2Fcommsite1'
82100
method: GET
101+
accept: application/json;odata.metadata=none
102+
odata-version: 4.0
83103
body: none
84104
```
85105

@@ -91,29 +111,20 @@ If the site exists, the response returns the site status and site URL:
91111

92112
```json
93113
{
94-
"d":{
95-
"Status":{
96-
"__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"},
97-
"SiteStatus":2,
98-
"SiteUrl":"https://contoso.sharepoint.com/sites/comm1"
99-
}
100-
}
114+
"SiteId":"d11e59ca-1465-424c-be90-c847ba849af5",
115+
"SiteStatus":2,
116+
"SiteUrl":"https://contoso.sharepoint.com/sites/comm1"
101117
}
102118
```
103119

104-
<br/>
105120

106-
If the site does not exist, the response returns a site status of 0 with no URL.
121+
If the site does not exist, the response returns a site status of 0 with no URL and no site id.
107122

108123
```json
109-
{
110-
"d":{
111-
"Status":{
112-
"__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"},
113-
"SiteStatus":0,
114-
"SiteUrl":
115-
}
116-
}
124+
{
125+
"SiteId":,
126+
"SiteStatus":0,
127+
"SiteUrl":
117128
}
118129
```
119130

0 commit comments

Comments
 (0)