Create Site from Template

post

/documents/api/1.2/templates/{templateId}/site

Create a site from an existing template.

Request

Supported Media Types
Path Parameters
Body ()

This parameter includes information such as the name parameter, which is the name of the site. Other parameters supported are description and copyUpdates.

Root Schema : SitesCreateFromTemplateBody
Type: object
The request body defines details of the site to be created.
Show Source
  • Flag indicating whether updates from the source site should be copied (1) or not (0) to the new site.
  • Description of the site to be created.
  • Name of the site to be created.

    The following restrictions apply to site names:

    • Site name can't start or end with spaces.
    • The length of the name can't exceed 250 characters.
    • Site name isn't case-sensitive; that is, My Site and MY SITE are considered identical.

    Don't use the following characters:

     / \ < > * "
     ? : . .. |

    The following strings are also not allowed in site names:

    • documents
    • sites
    • authsite
    • mobileauthsite
    • _sitescloud
    • _sitesclouddelivery
    • _comps
    • _components
    • _compdelivery
    • _idcservice
    • scstemplate_*
    • CON
    • PRN
    • AUX
    • CLOCK$
    • NUL
    • NULL
    • COM0
    • COM1
    • COM2
    • COM3
    • COM4
    • COM5
    • COM6
    • COM7
    • COM8
    • COM9
    • LPT0
    • LPT1
    • LPT2
    • LPT3
    • LPT4
    • LPT5
    • LPT6
    • LPT7
    • LPT8
    • LPT9
    • .DS_STORE
    • Users
    • _shortcuts
    • REALITEMS
    • Personal Libraries
    • Shared By Me
    • Shared With Me
    • Favorites
    • Trash

Example Request (application/json)
{
    "name":"Site Sample from Template",
    "description":"Site created from an existing template",
    "copyUpdates":"1"
}
Back to Top

Response

Supported Media Types

201 Response

The request was fulfilled.

Body ()
Root Schema : SiteCreateFromTemplateResponse
Type: object

The response includes details on the created site.

Show Source
Nested Schema : User
Type: object
User information
Show Source
Example Response (application/json)
{
    "createdBy":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User AA",
        "loginName":"UserAA",
        "type":"user"
    },
    "createdTime":"2017-06-12T21:05:10Z",
    "description":"Site created from an existing template",
    "errorCode":"0",
    "id":"F4FAEFCE084DD434A61B7CA9B5D17B95F47087F4E518",
    "modifiedBy":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User AA",
        "loginName":"UserAA",
        "type":"user"
    },
    "modifiedTime":"2017-06-12T21:05:10Z",
    "name":"Site Sample from Template",
    "ownedBy":{
        "id":"docadmin",
        "displayName":"Oracle Documents Administrator",
        "loginName":"docadmin",
        "type":"user"
    },
    "pseudoOwnedBy":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User AA",
        "loginName":"UserAA",
        "type":"user"
    },
    "type":"site"
}

400 Response

Request parameters are not formatted correctly.

403 Response

User has insufficient privilege to access Template ID.

404 Response

Template ID is not found.

409 Response

Site name already exists.

Back to Top

Examples

The following example creates a new site from an existing template.

POST .../templates/F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E518/site

Request Header

None.

Request Body

{
	"name":"Site Sample from Template",
	"description":"Site created from an existing template",
	"copyUpdates":"1"
}

HTTP Status Code

HTTP_STATUS = 201

JSON Response

{
  "createdBy": {
    "displayName": "User AA",
    "id": "UEB6AD431E4357AE752CE3F2B5D17B95F470",
    "loginName": "userAALoginName",
    "type": "user"
  },
  "createdTime": "2017-06-12T21:05:10Z",
  "description": "Site created from an existing template",
  "errorCode": "0",
  "id": "F4DA4BC72B3CA38C532E3A0AB5D17B95F47087F4E518",
  "modifiedBy": {
    "displayName": "User AA",
    "id": "UEB6AD431E4357AE752CE3F2B5D17B95F470",
    "loginName": "userAALoginName",
    "type": "user"
  },
  "modifiedTime": "2017-06-12T21:05:10Z",
  "name": "Site Sample from Template",
  "ownedBy": {
    "displayName": "Oracle Documents Administrator",
    "id": "docadmin",
    "loginName": "docadmin",
    "type": "user"
  },
  "pseudoOwnedBy": {
    "displayName": "User AA",
    "id": "UEB6AD431E4357AE752CE3F2B5D17B95F470",
    "loginName": "userAALoginName",
    "type": "user"
  },
  "type": "site"
}

Example 2

The following example attempts to create a new site using an existing name.

POST .../templates/F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E518/site

Request Header

None.

Request Body

{
	"name":"Site Name Already Exists",
	"description":"Trying to create new site using existing name",
	"copyUpdates":"1"
}

HTTP Status Code

HTTP_STATUS = 409

JSON Response

{
    "errorCode": "-17",
    "errorKey": "!csFldUnableToCopyItems!csFldPathAlreadyExists,Site Name Already Exists,F:SCS:SITES",
    "errorMessage": "Unable to copy items. An item with name 'Site Name Already Exists' already exists at 'F:SCS:SITES'.",
    "errorType": "site",
    "title": "Unable to copy items. An item with name 'Site Name Already Exists' already exists at 'F:SCS:SITES'.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}

Example 3

The following example attempts to create a new site using an invalid template ID.

POST .../templates/F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E518aaaa/site

Request Header

None.

Request Body

{
	"name":"Site From Invalid Template",
	"description":"This template does not exist",
	"copyUpdates":"1"
}

HTTP Status Code

HTTP_STATUS = 404

JSON Response

{
    "copyUpdates": "1",
    "description": "This template does not exist",
    "errorCode": "-16",
    "errorKey": "!csSecurityValidationFailed!csFldDoesNotExist,F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E5181!csUnprivilegedSystemError",
    "errorMessage": "Security validation failed. 'F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E5181' does not exist. The error was caused by an internally generated issue. The error has been logged.",
    "errorType": "site",
    "idList": "F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E5181",
    "name": "Site From Invalid Template",
    "title": "Security validation failed. 'F79233B387ECFE0E1EC5F9B2B5D17B95F47087F4E5181' does not exist. The error was caused by an internally generated issue. The error has been logged.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}
Back to Top