Copy page to a new location
Name | Type | Description |
pageid | string | either an integer page ID, "home", or "=" followed by a double uri-encoded page path |
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) |
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 |
A file cannot be moved to a template page or a destination page that already contains a file with the same name.
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".
curl -u username:password -d "" -i http://mindtouch.address/@api/deki/pages/=foo/copy?to=bar
curl -u username:password -d "" -i "http://mindtouch.address/@api/deki/pages/=foo/copy?to=bar%252ffoo&children=true"
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:
If you copy "/Parent/Page_1" under "/Parent_2", the new "/Parent_2/Page_1" page will inherit the existing permissions of "/Parent_2":
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.
curl -u admin:password -d "" -i http://192.168.168.110/@api/deki/pages/=Planets%252fPluto/copy?to=Floating%2520Rocks%252fPluto
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
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>