Copy a Component

post

/sites/management/api/v1/components/{id}/copy

EXTENDED OPERATION

Copy a component by providing a new component name and optional description. Component names are case sensitive and two components cannot share the same name. Use only letters, numbers, hyphens, and underscores in component names. Copying a component also copies the component folder, including all the component artifacts.

Introduced in release 19.4.1.

Authorization

To invoke this operation, the authenticated user or client application must have been shared with the resource and have one of the following sharing roles:

  • Owner
  • Manager
  • Contributor
  • Downloader

To invoke this operation, the authenticated user or client application must have one of the following roles:

  • CECDeveloperUser
  • CECSitesAdministrator
  • CECContentAdministrator

Asynchronous Processing

This operation supports both asynchronous and synchronous processing. The client can specify a preferred interaction mode by adding a Prefer header with a value of respond-async. The server may change an asynchronous request to synchronous so the client should be prepared to handle both cases. An accepted response will include a Location header, which provides the location of a status resource that can be polled to obtain information about the asynchronous processing.

Path Alternative Identifiers

The default identifier for a Component resource is the Component Identifier. The Component resource supports alternative identifiers.

nameComponent Name

Instead of the component identifier, the component name can be used to uniquely identify a component in the resource path. The default resource path parameter for a component is the component identifier, but when working with components the human-readable component name is sometimes easier.

http://api.example.com/sites/management/api/v1/components/name:FooterBar/copy

Introduced in release 19.4.1.

Successful Response Examples

This operation responds with the following success (2xx) responses. For a full list of response HTTP status codes and example bodies, consult the Response section of this operation.

201Created - Copy With a New Name and Description

Copy a component specifying a new name and description for the copy.

Request

POST https://api.example.com/sites/management/api/v1/components/{id}/copy

Request Body

{
  "name": "FooterBar",
  "description": "A copy of the footer bar component."
}

202Accepted - Copy Asynchronously With a New Name and Description

Copy a component asynchronously, specifying a new name and description for the copy.

Request

POST https://api.example.com/sites/management/api/v1/components/{id}/copy

Request Headers

Prefer=respond-async

Request Body

{
  "name": "FooterBar",
  "description": "A copy of the footer bar component."
}
Introduced in release 22.6.2.

Client Error Response Examples

This operation responds with the following client error (4xx) responses, with exception details in the response body or reported through the asynchronous job. For a full list of response HTTP status codes and example bodies, consult the Response section of this operation.

400Bad Request - Invalid Component Name

The provided component name cannot be used because it contains characters or words that are not allowed. The reason the component name is invalid will be reported in the error message.

Error Code

OCE-SITEMGMT-009044

Resolution - Remove Spaces

Change the component name so that it does not contain spaces.

Resolution - Check Characters

Use only letters, numbers, hyphens, and underscores in component names.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
componentNameInvalid component name.
reasonReason the component name is invalid. Valid values are:
  • tooLong - Name is too long
  • invalidCharacters - Name contains invalid characters
  • startWithSpace - Name starts with a space
  • endWithSpace - Name ends with a space
  • internalWord - Name is a restricted internal word
  • empty - Name is empty

For detailed information about this exception detail type, consult the InvalidComponentNameExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Invalid Component Name",
  "status": "400",
  "detail": "Component name '{componentName}' cannot be used to create a component.",
  "o:errorCode": "OCE-SITEMGMT-009044",
  "componentName": "ContentNavMenu",
  "reason": "tooLong"
}

Introduced in release 19.4.1.

403Forbidden - Storage Limit Reached

Storage transfer limit has been reached. Billing limits have been set on the amount of storage available by the system administrator.

Error Code

OCE-SITEMGMT-009098

Resolution - Increase Storage Limit

Get a system administrator to increase the storage limit.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
usedStorage used, in GB.
limitStorage limit, in GB.

For detailed information about this exception detail type, consult the StorageLimitReachedExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Storage Limit Reached",
  "status": "403",
  "detail": "Storage limit has been reached.",
  "o:errorCode": "OCE-SITEMGMT-009098",
  "used": 1.23456789,
  "limit": 1.23456789
}

Introduced in release 20.3.1.

403Forbidden - Sites Administrator Role Required

The Sites Administrator role is required to create resources of this type.

Error Code

OCE-SITEMGMT-009140

Resolution - Change Sites System Settings

Creation of sites, templates, themes and components can be restricted to sites administrators. Update the Sites System settings to allow creation of sites resources of this type by non admin users.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
resourceTypeResource type that can only be created by Sites Administrators. Valid values are:
  • site - Site resource
  • template - Template resource
  • theme - Theme resource
  • component - Component resource
nameName of resource being created, if available.

For detailed information about this exception detail type, consult the SitesAdminRoleRequiredExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Sites Administrator Role Required",
  "status": "403",
  "detail": "The Sites Administrator role is required to create resources of this type.",
  "o:errorCode": "OCE-SITEMGMT-009140",
  "resourceType": "site",
  "name": "value"
}

Introduced in release 22.5.2.

404Not Found - Component Not Found

The site component does not exist or has been deleted, or the authenticated user or client application does not have access to the component.

Error Code

OCE-SITEMGMT-009045

Resolution - Check Identifier

Check that the component identifier is valid.

Resolution - Check Membership

Check that the authenticated user is a member of the component.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
componentComponent that does not exist or is not visible to the authenticated user.

For detailed information about this exception detail type, consult the ComponentNotFoundExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Component Not Found",
  "status": "404",
  "detail": "Component does not exist or has been deleted, or the authenticated user or client application does not have access to the component.",
  "o:errorCode": "OCE-SITEMGMT-009045",
  "component": {
    "id": "F40B9BE3E69F6DC440559A1F033BB2482DB740ECB2D8"
  }
}

Introduced in release 19.4.1.

409Conflict - Component Already Exists

A component with the same name or identity already exists. Component names and identities must be unique across all components.

Error Code

OCE-SITEMGMT-009043

Resolution - Change the Component Name

If clashing on name during a copy or rename, choose a different name.

Resolution - Change the Conflict Resolution Name

If clashing on name during an import, choose a different name for the component conflict resolution.

Resolution - Change the Conflict Resolution Action

If clashing on identity during an import, change the component conflict resolution type to overwrite or create.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
componentDuplicate component.
nameDuplicate name.
itemGuidDuplicate identity Guid.

For detailed information about this exception detail type, consult the ComponentAlreadyExistsExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Component Already Exists",
  "status": "409",
  "detail": "A component with the same name or identity already exists.",
  "o:errorCode": "OCE-SITEMGMT-009043",
  "component": {
    "id": "F40B9BE3E69F6DC440559A1F033BB2482DB740ECB2D8"
  },
  "name": "ContentNavMenu",
  "itemGuid": "value"
}

Introduced in release 19.4.1.

409Conflict - Component Deleted

The operation cannot be performed on a soft deleted component. This error can only occur when the includeDeleted query parameter set to true

Error Code

OCE-SITEMGMT-009060

Resolution - Restore Component

Restore the component and then try the operation again.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
componentComponent that is soft deleted.

For detailed information about this exception detail type, consult the ComponentDeletedExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Component Deleted",
  "status": "409",
  "detail": "The operation cannot be performed as the component has been soft deleted.",
  "o:errorCode": "OCE-SITEMGMT-009060",
  "component": {
    "id": "F40B9BE3E69F6DC440559A1F033BB2482DB740ECB2D8"
  }
}

Introduced in release 19.4.1.

409Conflict - Component Import In Progress

This error will occur when a component is being copied, but at the same time it is being overwritten by a component import.

Error Code

OCE-SITEMGMT-009107

Resolution - Wait for Component Import to Complete

Wait for the component import to complete and try again.

Where This Error Can be Returned
  • This error can be returned in the response body.
  • This error will not be returned in the asynchronous job status.
Exception Detail Fields

This error type includes the following fields/values in the response:

Field NameDescription
importedByFull name of the user that created the import job that is in progress.
nameComponent name.

For detailed information about this exception detail type, consult the ComponentImportInProgressExceptionDetail schema in the definitions section of the swagger document.

Example Response Body
{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Component Import In Progress",
  "status": "409",
  "detail": "Unable to access component as it is in the progress of being re-imported.",
  "o:errorCode": "OCE-SITEMGMT-009107",
  "importedBy": "value",
  "name": "ContentNavMenu"
}

Introduced in release 20.4.2.

Request

Supported Media Types
Path Parameters
Query Parameters
  • Resources that have been marked for deletion can be read, modified, and support extended operations as long this query parameter is set to true. When the includeDeleted query parameter is not sent then the response to read, modification, and extended operations will be identical to that which would be returned if the resource was permanently deleted.

Header Parameters
Body ()

Name and optional description for the copy.

Root Schema : schema
Type: object
Show Source
  • Maximum Length: 1000

    Optional description. There is no restriction on the contents of the description; it can be a single line or multiple lines with any characters.

    Introduced in release 19.4.1.
  • Maximum Length: 255

    Name of the component.

    Introduced in release 19.4.1.
Example:
{
    "name":"FooterBar",
    "description":"A copy of the footer bar component."
}
Back to Top

Response

201 Response

Created
Headers

202 Response

Accepted
Headers

400 Response

Bad Request
Body ()
Root Schema : schema
Match All
Show Source
Nested Schema : InvalidComponentNameExceptionDetail
Introduced in release 19.4.1.
Match All
Show Source
Nested Schema : ExceptionDetail
Type: object

In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Show Source
Nested Schema : InvalidComponentNameExceptionDetail-allOf[1]
Type: object
Show Source
  • Maximum Length: 255

    Invalid component name.

    Introduced in release 19.4.1.
  • Reason the component name is invalid.

    Valid values are:

    • tooLong - Name is too long
    • invalidCharacters - Name contains invalid characters
    • startWithSpace - Name starts with a space
    • endWithSpace - Name ends with a space
    • internalWord - Name is a restricted internal word
    • empty - Name is empty

    Introduced in release 19.4.1.
Nested Schema : o:errorDetails
Type: array

Multiple errors can be organized in a hierarchical structure.

Show Source
Nested Schema : items
Match All
Show Source
  • ExceptionDetail

    In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Example Response (Invalid Component Name)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Invalid Component Name",
    "status":"400",
    "detail":"Component name '{componentName}' cannot be used to create a component.",
    "o:errorCode":"OCE-SITEMGMT-009044",
    "componentName":"ContentNavMenu",
    "reason":"tooLong"
}

401 Response

Unauthorized

403 Response

Forbidden
Body ()
Root Schema : schema
Match All
Show Source
Nested Schema : StorageLimitReachedExceptionDetail
Introduced in release 20.3.1.
Match All
Show Source
Nested Schema : ExceptionDetail
Type: object

In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Show Source
Nested Schema : StorageLimitReachedExceptionDetail-allOf[1]
Type: object
Show Source
Nested Schema : o:errorDetails
Type: array

Multiple errors can be organized in a hierarchical structure.

Show Source
Nested Schema : items
Match All
Show Source
  • ExceptionDetail

    In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Example Response (Storage Limit Reached)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Storage Limit Reached",
    "status":"403",
    "detail":"Storage limit has been reached.",
    "o:errorCode":"OCE-SITEMGMT-009098",
    "used":1.23456789,
    "limit":1.23456789
}
Example Response (Sites Administrator Role Required)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Sites Administrator Role Required",
    "status":"403",
    "detail":"The Sites Administrator role is required to create resources of this type.",
    "o:errorCode":"OCE-SITEMGMT-009140",
    "resourceType":"site",
    "name":"value"
}

404 Response

Not Found
Headers
Body ()
Root Schema : schema
Match All
Show Source
Nested Schema : ComponentNotFoundExceptionDetail
Introduced in release 19.4.1.
Match All
Show Source
Nested Schema : ExceptionDetail
Type: object

In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Show Source
Nested Schema : ComponentNotFoundExceptionDetail-allOf[1]
Type: object
Show Source
Nested Schema : o:errorDetails
Type: array

Multiple errors can be organized in a hierarchical structure.

Show Source
Nested Schema : items
Match All
Show Source
  • ExceptionDetail

    In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Example Response (Component Not Found)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Component Not Found",
    "status":"404",
    "detail":"Component does not exist or has been deleted, or the authenticated user or client application does not have access to the component.",
    "o:errorCode":"OCE-SITEMGMT-009045",
    "component":{
        "id":"F40B9BE3E69F6DC440559A1F033BB2482DB740ECB2D8"
    }
}

409 Response

Conflict
Body ()
Root Schema : schema
Match All
Show Source
Nested Schema : ComponentAlreadyExistsExceptionDetail
Introduced in release 19.4.1.
Match All
Show Source
Nested Schema : ExceptionDetail
Type: object

In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Show Source
Nested Schema : ComponentAlreadyExistsExceptionDetail-allOf[1]
Type: object
Show Source
Nested Schema : o:errorDetails
Type: array

Multiple errors can be organized in a hierarchical structure.

Show Source
Nested Schema : items
Match All
Show Source
  • ExceptionDetail

    In addition to HTTP error code and error messages, it is often desirable to provide additional information to the client when a request fails. In such cases, the additional information will be included in the response body.

Example Response (Component Already Exists)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Component Already Exists",
    "status":"409",
    "detail":"A component with the same name or identity already exists.",
    "o:errorCode":"OCE-SITEMGMT-009043",
    "component":{
        "id":"F40B9BE3E69F6DC440559A1F033BB2482DB740ECB2D8"
    },
    "name":"ContentNavMenu",
    "itemGuid":"value"
}
Example Response (Component Deleted)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Component Deleted",
    "status":"409",
    "detail":"The operation cannot be performed as the component has been soft deleted.",
    "o:errorCode":"OCE-SITEMGMT-009060",
    "component":{
        "id":"F40B9BE3E69F6DC440559A1F033BB2482DB740ECB2D8"
    }
}
Example Response (Component Import In Progress)
{
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title":"Component Import In Progress",
    "status":"409",
    "detail":"Unable to access component as it is in the progress of being re-imported.",
    "o:errorCode":"OCE-SITEMGMT-009107",
    "importedBy":"value",
    "name":"ContentNavMenu"
}

413 Response

Payload Too Large

415 Response

Unsupported Media Type

429 Response

Too Many Requests

500 Response

Internal Server Error

501 Response

Not Implemented

502 Response

Bad Gateway

503 Response

Service Unavailable

504 Response

Gateway Timeout
Back to Top