- Create a site
Creates a site for the environment. Sites are created using site templates. Every site belongs to a site collection. You can either create a site inside an existing collection or create a new one. It is also possible to create a site by duplicating a site.
Input model
The language for the site. If you do not know what languages are available in the environment, first retrieve the list of languages. If the language you want is not available in the environment, add the language first. Example value: en
The name of the site. Example value: skate-park
The ID of the template used to create the site. If you don't know the template ID, first retrieve site templates. Example value: 5aae1eeaea2440bf96f11f43da82c77b
The display name for the site. Example value: Skate Park Site
The ID of the collection you want the new site to belong to. If you don't know the collection ID, first retrieve collections. Required if Sitecore.XmApps.Sites.Models.REST.NewSiteInput.CollectionName is not provided. If left empty, you must provide collectionName instead and a new collection will be created along with the newly created site. If both collectionId and collectionName are provided, collectionName will be ignored. Example value: 5aae1eeaea2440bf96f11f43da82c77b
The list of supported languages for the site. Example value: [ "en", "da" ]
[ "en", "da" ]
Optional hostname for the new site. Default value: * Example value: dev.skate-park.com
Optional text that provides a meaningful description of the site. Example value: New site for Brand A in English-speaking countries.
The name of the new collection you want the new site to belong to. Required if Sitecore.XmApps.Sites.Models.REST.NewSiteInput.CollectionId is not provided. If left empty, you must provide collectionId of an existing collection you want the new site to belong to. If both collectionId and collectionName are provided, collectionName will be ignored. Example value: Brand A
The display name for the collection. Example value: Skate Park Site
If you want to create a new site collection while creating a new site, you can provide a collection description. Example value: Sample description for the site collection containing Sites for Brand A
The site identifier for the site. This identifier lets you control analytics and personalization for the site.
- Production serverhttps://xmapps-api.sitecorecloud.io/api/v1/sites
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
- application/json
- text/json
- application/*+json
curl -i -X POST \
'https://xmapps-api.sitecorecloud.io/api/v1/sites?environmentId=main' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"siteName": "skate-park",
"displayName": "Skate Park Site",
"templateId": "5aae1eeaea2440bf96f11f43da82c77b",
"collectionId": "5aae1eeaea2440bf96f11f43da82c77b",
"language": "en",
"languages": [
"en",
"da"
],
"hostName": "dev.skate-park.com",
"description": "New site for Brand A in English-speaking countries.",
"collectionName": "Brand A",
"collectionDisplayName": "Skate Park Site",
"collectionDescription": "Sample description for the site collection containing Sites for Brand A",
"posMappings": [
{
"name": "skate-park",
"language": "en"
}
]
}'