Skip to main content
NICE CXone Expert
Expert Success Center

pages/{pageid}/move (POST)

Overview

Move 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
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

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

Message Format

Output:

<pages.moved count="{int}">
    <page id="{int}" href="{uri}">
        <title>{text}</title> 
        <path>{text}</path> 
    </page>
    ...
</pages.moved>

Implementation Notes

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.

C# Code Sample: Rename a Page

The following code example renames "Subpage 1" to "New Subpage 1":

Sample Code

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();

Sample Response from executing Code

<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>

Curl Code Sample: Move/Rename a Page

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".

Sample Code (Rename)

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

Sample Code (Move)

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

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.

Example

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.

Sample Code

curl -u admin:password -d "" -i http://192.168.168.110/@api/deki/pages/=Planets%252fPluto/move?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.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>

Notes

  • The page path is double encoded. In the above example, spaces in "Floating rocks" are replaced with %2520. Likewise, forward slashes (/) are replaced with %252f.
  • Attempting to move a page to a location where a page with the same name already exists will result in a 409 HTTP response (Conflict).
  • Was this article helpful?