Move 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 |
parentid | int? | Relocate the page under a given parent page |
name | string? | Move the page to the given name while keeping it under the same parent page |
authenticate | bool? | Force authentication for request (default: false) |
title | string? | Set the title of the page. The name of a page is also modified unless it's provided |
to | string? | new page location including the path and name of the page |
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 |
Output:
<pages.moved count="{int}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> ... </pages.moved>
A page cannot be moved to a destination that already exists, is a descendant, or has a protected title (ex. Special:xxx, User:, Template:).
When a page is moved, sub-pages under the specified page are also moved. For each moved page, the system automatically creates an alias page that redirects from the old to the new destination.
The following code example renames "Subpage 1" to "New Subpage 1":
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("pages", "=Page_Title%252fSubpage_1", "move").With("to", "Page_Title/New_Subpage_1").Post();
<pages.moved count="1"> <page id="83" href="http://deki-hayes/@api/deki/pages/83"> <title>New Subpage 1</title> <path>Page_Title/New_Subpage_1</path> </page> </pages.moved>
The first of the two commands moves page "foo" to page "bar" as indicated by the "?to=" parameter. It is important to note that since the page is in the same path directory, it is essentially renamed. In the second code sample, page "foo" is moved to a sub-page of page "bar".
curl -u username:password -d "" -i http://mindtouch.address/@api/deki/pages/=foo/move?to=bar
curl -u username:password -d "" -i http://mindtouch.address/@api/deki/pages/=foo/move?to=bar%252ffoo
In this example we will move 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/move?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.moved 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.moved>