pages/{pageid} (DELETE)
Overview
Deletes a page and optionally descendant pages by moving them to the archive
- REST Method: DELETE
- 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 |
authenticate | bool? | Force authentication for request (default: false) |
redirects | int? | If zero, do not follow page redirects. |
recursive | bool? | only delete page or delete page and descendants. Default: false |
Return Codes
Name | Value | Description |
OK | 200 | Request completed successfully |
Bad Request | 400 | Invalid input parameter or request body |
Forbidden | 403 | Update/delete access to the page is required |
Not Found | 404 | Requested page could not be found |
Message Format
Output:
<deletedpages count="{int}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> ... </deletedpages>
Implementation Notes
When a page is deleted, the page and all files on it are moved into the archive. A page is never permanently deleted; it will remain in the archive until it is restored (POST:archive/pages/{pageid}/restore). While a page is in the archive, it cannot be modified.
If the recursive=true query parameter is specified, the page and all its descendants will be deleted. Otherwise, if the page has descendants, a placeholder parent page will be created for them.
Use GET:pages to retrieve a list of existing pages.
C# Code Sample: Delete a Page
The following code example deletes the page with ID 41:
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("pages", "41").Delete();
Sample Response from executing Code
<deletedpages count="1"> <page id="41" href="http://deki-hayes/@api/deki/pages/41"> <title>Page Title</title> <path>Page_Title</path> </page> </deletedpages>
Curl Code Sample: Remove a Page
The following command deletes page "foo":
Sample Code
curl -u username:password -X DELETE -i http://mindtouch.address/@api/deki/pages/=foo
Implementation notes
curl flags
- -u
- Provides external user authentication.
- -X
- Specifies the HTTP request method.
- -i
- Outputs the HTTP response headers. Useful for debugging.
Sample Response
Page name = Starfleet
HTTP Response Headers
HTTP/1.1 200 OK Date: Tue, 26 Jan 2010 22:30:13 GMT Server: Dream-HTTPAPI/2.0.0.17629 Microsoft-HTTPAPI/2.0 Content-Length: 243 Content-Type: application/xml; charset=utf-8 X-Data-Stats: request-time-ms=22; mysql-queries=16; mysql-time-ms=20; X-Deki-Site: id="default" Via: 1.1 dekiwiki
HTTP Response Body
Content-Type: application/xml
<deletedpages count="1"> <page id="569" href="http://192.168.59.128/@api/deki/pages/569?redirects=0"> <uri.ui>http://192.168.59.128/Starfleet</uri.ui> <title>Starfleet</title> <path>Starfleet</path> <namespace>main</namespace> </page> </deletedpages>
Notes
- To delete a page and its sub-pages, append "?recursive=true" to the end of the path. e.g:
curl -u username:password -X DELETE -i http://mindtouch.host/@api/deki/pages/=foo?recursive=true
- Deleted pages are placed in the archive, where they can be either restored or permanently deleted.