|
1 |
| ---- |
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. |
4 |
| -ms.date: 4/19/2018 |
5 |
| -ms.prod: sharepoint |
6 |
| ---- |
7 |
| - |
8 |
| -# Create SharePoint Communication site using REST |
9 |
| - |
10 |
| -This topic assumes that you are already familiar with the following topics: |
11 |
| - |
12 |
| -- [Get to know the SharePoint REST service](../sp-add-ins/get-to-know-the-sharepoint-rest-service.md) |
13 |
| -- [Complete basic operations using SharePoint REST endpoints](../sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints.md) |
14 |
| - |
15 |
| -This topic does not provide code snippets. |
16 |
| - |
17 |
| -The following REST commands are available for creating a modern SharePoint Communication site: |
18 |
| - |
19 |
| -- **Create**. Create a new SharePoint Communication site. |
20 |
| -- **Status**. Get the status of a SharePoint Communication site. |
21 |
| - |
22 |
| -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: |
23 |
| - |
24 |
| -- `http:///_api/sitepages/communicationsite/create` |
25 |
| -- `http:///_api/sitepages/communicationsite/status` |
26 |
| - |
27 |
| -## Create Communication site |
28 |
| - |
29 |
| -```json |
30 |
| -url: /_api/sitepages/communicationsite/create |
31 |
| -method: POST |
32 |
| -body: |
33 |
| -{ |
34 |
| - "request":{ |
35 |
| - "__metadata":{ |
36 |
| - "type":"SP.Publishing.CommunicationSiteCreationRequest" |
37 |
| - }, |
38 |
| - "AllowFileSharingForGuestUsers":false, |
39 |
| - "Classification":"LBI", |
40 |
| - "Description":"Description", |
41 |
| - "SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767", |
42 |
| - "Title":"Comm Site 1", |
43 |
| - "Url":"https://vesku.sharepoint.com/sites/commsite132", |
44 |
| - "lcid":1033 |
45 |
| - } |
46 |
| -} |
47 |
| -``` |
48 |
| - |
49 |
| -> [!IMPORTANT] |
50 |
| -> The `lcid` parameter is not currently supported with this API. You can currently only create English sites. |
51 |
| -
|
52 |
| -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: |
53 |
| - |
54 |
| -- Topic: null |
55 |
| -- Showcase: 6142d2a0-63a5-4ba0-aede-d9fefca2c767 |
56 |
| -- Blank: f6cc5403-0d63-442e-96c0-285923709ffc |
57 |
| - |
58 |
| -### Response |
59 |
| - |
60 |
| -If successful, this method returns a `200, OK` response code and simple JSON object in the response body with the following details. |
61 |
| - |
62 |
| -```json |
63 |
| -{ |
64 |
| - "d":{ |
65 |
| - "Create":{ |
66 |
| - "__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"}, |
67 |
| - "SiteStatus":2, |
68 |
| - "SiteUrl":"https://contoso.sharepoint.com/sites/comm1" |
69 |
| - } |
70 |
| - } |
71 |
| -} |
72 |
| -``` |
73 |
| - |
74 |
| - |
75 |
| -## Get Communication site status |
76 |
| - |
77 |
| -The REST API for getting the status of a modern SharePoint Communication site: |
78 |
| - |
79 |
| -```json |
80 |
| -url: /_api/sitepages/communicationsite/status?url='https%3A%2F%2Fcontoso.sharepoint.com%2Fsites%2Fcomm1' |
81 |
| -method: GET |
82 |
| -body: none |
83 |
| -``` |
84 |
| - |
85 |
| -### Response |
86 |
| - |
87 |
| -If successful, this method returns a `200, OK` response code and simple JSON object in the response body with the following details. |
88 |
| - |
89 |
| -If the site exists, the response returns the site status and site URL: |
90 |
| - |
91 |
| -```json |
92 |
| -{ |
93 |
| - "d":{ |
94 |
| - "Status":{ |
95 |
| - "__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"}, |
96 |
| - "SiteStatus":2, |
97 |
| - "SiteUrl":"https://contoso.sharepoint.com/sites/comm1" |
98 |
| - } |
99 |
| - } |
100 |
| -} |
101 |
| -``` |
102 |
| - |
103 |
| -<br/> |
104 |
| - |
105 |
| -If the site does not exist, the response returns a site status of 0 with no URL. |
106 |
| - |
107 |
| -```json |
108 |
| -{ |
109 |
| - "d":{ |
110 |
| - "Status":{ |
111 |
| - "__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"}, |
112 |
| - "SiteStatus":0, |
113 |
| - "SiteUrl": |
114 |
| - } |
115 |
| - } |
116 |
| -} |
117 |
| -``` |
118 |
| - |
119 |
| -The full set of values for SiteStatus are as follows: |
120 |
| - |
121 |
| -+ `0` - Not Found. The site doesn't exist. |
122 |
| -+ `1` - Provisioning. The site is currently being provisioned. |
123 |
| -+ `2` - Ready. The site has been created. |
124 |
| -+ `3` - Error. An error occurred while provisioning the site. |
125 |
| - |
126 |
| -## See also |
127 |
| - |
128 |
| -- [Get to know the SharePoint REST service](../sp-add-ins/get-to-know-the-sharepoint-rest-service.md) |
| 1 | +--- |
| 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. |
| 4 | +ms.date: 4/19/2018 |
| 5 | +ms.prod: sharepoint |
| 6 | +localization_priority: Priority |
| 7 | +--- |
| 8 | + |
| 9 | +# Create SharePoint Communication site using REST |
| 10 | + |
| 11 | +This topic assumes that you are already familiar with the following topics: |
| 12 | + |
| 13 | +- [Get to know the SharePoint REST service](../sp-add-ins/get-to-know-the-sharepoint-rest-service.md) |
| 14 | +- [Complete basic operations using SharePoint REST endpoints](../sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints.md) |
| 15 | + |
| 16 | +This topic does not provide code snippets. |
| 17 | + |
| 18 | +The following REST commands are available for creating a modern SharePoint Communication site: |
| 19 | + |
| 20 | +- **Create**. Create a new SharePoint Communication site. |
| 21 | +- **Status**. Get the status of a SharePoint Communication site. |
| 22 | + |
| 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 | + |
| 25 | +- `http:///_api/sitepages/communicationsite/create` |
| 26 | +- `http:///_api/sitepages/communicationsite/status` |
| 27 | + |
| 28 | +## Create Communication site |
| 29 | + |
| 30 | +```json |
| 31 | +url: /_api/sitepages/communicationsite/create |
| 32 | +method: POST |
| 33 | +body: |
| 34 | +{ |
| 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 | + } |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +> [!IMPORTANT] |
| 51 | +> The `lcid` parameter is not currently supported with this API. You can currently only create English sites. |
| 52 | +
|
| 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: |
| 54 | + |
| 55 | +- Topic: null |
| 56 | +- Showcase: 6142d2a0-63a5-4ba0-aede-d9fefca2c767 |
| 57 | +- Blank: f6cc5403-0d63-442e-96c0-285923709ffc |
| 58 | + |
| 59 | +### Response |
| 60 | + |
| 61 | +If successful, this method returns a `200, OK` response code and simple JSON object in the response body with the following details. |
| 62 | + |
| 63 | +```json |
| 64 | +{ |
| 65 | + "d":{ |
| 66 | + "Create":{ |
| 67 | + "__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"}, |
| 68 | + "SiteStatus":2, |
| 69 | + "SiteUrl":"https://contoso.sharepoint.com/sites/comm1" |
| 70 | + } |
| 71 | + } |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | + |
| 76 | +## Get Communication site status |
| 77 | + |
| 78 | +The REST API for getting the status of a modern SharePoint Communication site: |
| 79 | + |
| 80 | +```json |
| 81 | +url: /_api/sitepages/communicationsite/status?url='https%3A%2F%2Fcontoso.sharepoint.com%2Fsites%2Fcomm1' |
| 82 | +method: GET |
| 83 | +body: none |
| 84 | +``` |
| 85 | + |
| 86 | +### Response |
| 87 | + |
| 88 | +If successful, this method returns a `200, OK` response code and simple JSON object in the response body with the following details. |
| 89 | + |
| 90 | +If the site exists, the response returns the site status and site URL: |
| 91 | + |
| 92 | +```json |
| 93 | +{ |
| 94 | + "d":{ |
| 95 | + "Status":{ |
| 96 | + "__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"}, |
| 97 | + "SiteStatus":2, |
| 98 | + "SiteUrl":"https://contoso.sharepoint.com/sites/comm1" |
| 99 | + } |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +<br/> |
| 105 | + |
| 106 | +If the site does not exist, the response returns a site status of 0 with no URL. |
| 107 | + |
| 108 | +```json |
| 109 | +{ |
| 110 | + "d":{ |
| 111 | + "Status":{ |
| 112 | + "__metadata":{"type":"SP.Publishing.CommunicationSiteCreationResponse"}, |
| 113 | + "SiteStatus":0, |
| 114 | + "SiteUrl": |
| 115 | + } |
| 116 | + } |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +The full set of values for SiteStatus are as follows: |
| 121 | + |
| 122 | ++ `0` - Not Found. The site doesn't exist. |
| 123 | ++ `1` - Provisioning. The site is currently being provisioned. |
| 124 | ++ `2` - Ready. The site has been created. |
| 125 | ++ `3` - Error. An error occurred while provisioning the site. |
| 126 | + |
| 127 | +## See also |
| 128 | + |
| 129 | +- [Get to know the SharePoint REST service](../sp-add-ins/get-to-know-the-sharepoint-rest-service.md) |
0 commit comments