Skip to main content
NICE CXone Expert
Expert Success Center

pages/{pageid}/copy (POST)

Overview

Copy page to a new location

  • REST Method: POST
  • Method Access: public

Uri Parameters

Name Type Description
pageid string either an integer page ID, "home", or "=" followed by a double uri-encoded page path

Query Parameters

Name Type Description
children bool? Copy child pages? (deprecated, use 'recursive' instead) (default: false)
to string new page location including the path and name of the page
title string? Set the title of the page. (default: same as original title)
abort {never, exists}? Specifies condition under which to prevent the update; default is exists.
recursive bool? Copy child pages? (default: false)
authenticate bool? Force authentication for request (default: false)
tags bool? Copy tags? (default: true)
attachments bool? Copy attachments? (default: true)

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body
Forbidden 403 Update access to the page is required
Not Found 404 Requested page could not be found
Conflict 409 Page move would conflict with an existing page

Implementation Notes

A file cannot be moved to a template page or a destination page that already contains a file with the same name.

Curl Code Sample: Copy a page

The first of the two commands copy page "foo" to page "bar" as indicated by the "?to=" parameter. In the second code sample, page "foo" is copied to a sub-page of page "bar".

Sample Code (Copy)

curl -u username:password -d "" -i http://mindtouch.address/@api/deki/pages/=foo/copy?to=bar

Sample Code (Copy page with children)

curl -u username:password -d "" -i "http://mindtouch.address/@api/deki/pages/=foo/copy?to=bar%252ffoo&children=true"

Implementation notes 

curl flags

-u:
Basic HTTP authentication. Sends a username and password to server so it can verify whether a user is of privilege to perform specific operation.
-d
Specifies a POST request. The parentheses ("") imply no data, since no external data is required to complete the operation.
-i
Includes the HTTP response header in the output. Useful for debugging.

How Permissions are Handled

Just like when creating a new page, if you copy a section to a new location the copied content will inherit the permissions of the parent page you are copying to.

For instance, if you have the following structure:

  • /Parent
    • /Parent/Page_1
    • /Parent/Page_2
  • /Parent_2

If you copy "/Parent/Page_1"  under "/Parent_2", the new "/Parent_2/Page_1" page will inherit the existing permissions of "/Parent_2":

  • /Parent
    • /Parent/Page_1
    • /Parent/Page_2
  • /Parent_2
    • /Parent_2/Page_1 (this page will inherit the permissions of "/Parent_2")

Example

In this example we will copy Pluto from a sub-page of Planets to a sub-page of Floating Rocks (Planets/Pluto -> Floating_Rocks/Pluto). The parent pages are assumed to have already been created. To learn how to create new pages, click here.

Sample Code

curl -u admin:password -d "" -i http://192.168.168.110/@api/deki/pages/=Planets%252fPluto/copy?to=Floating%2520Rocks%252fPluto

HTTP Response Headers

HTTP/1.1 200 OK
Date: Sat, 09 Jan 2010 00:44:00 GMT
Server: Dream-HTTPAPI/1.7.2.17433
X-Deki-Site: id="default"
Content-Type: application/xml; charset=utf-8
Content-Length: 259
Via: 1.1 dekiwiki

HTTP Response Body

Content-Type: application/xml

<?xml version="1.0"?>
<pages.copied count="1">
  <page id="64" href="http://192.168.168.110/@api/deki/pages/64?redirects=0">
    <uri.ui>http://192.168.168.110/Floating_Rocks/Pluto</uri.ui>
    <title>Pluto</title>
    <path>Floating_Rocks/Pluto</path>
    <namespace>main</namespace>
  </page>
</pages.copied>

 

  • Was this article helpful?