files/{fileid}/description (DELETE)
Overview
Reset the file description
- REST Method: DELETE
- Method Access: public
Uri Parameters
Name | Type | Description |
filename | string | Double uri-encoded file name. Should be prefixed with "=" if it does not have an extension. |
fileid | int | identifies a file by ID |
pageid | string | either an integer page ID, "home", or "=" followed by a double uri-encoded page title |
Query Parameters
Name | Type | Description |
authenticate | bool? | Force authentication for request (default: false) |
redirects | int? | If zero, do not follow page redirects (only applies when {pageid} is present). |
Return Codes
Name | Value | Description |
OK | 200 | 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 file could not be found |
Message Format
Output :
<file id="{int}" href="{uri}"> <filename>{text}</filename> <description /> <contents type="{mimetype}" size="{int}" width="{int}" height="{int}" href="{uri}" /> <contents.preview rel="thumb" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" /> <contents.preview rel="webview" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" /> <date.created>{date}</date.created> <user.createdby id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> <email>{text}</email> </user.createdby> <revisions count="{int}" href="{uri}" /> <page.parent id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page.parent> </file>
Implementation Notes
Use GET:files to retrieve a list of files across the site or GET:pages/{pageid}/files to retrieve the files on a specified page.
C# Code Sample: Delete a File
The following code example deletes the description for file with ID 456:
Sample Code
Plug p = Plug.New("http://help.mindtouch.us/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("files", "456", "description").Delete();
Sample Response from executing Code
<file id="456" href="http://help.mindtouch.us/@api/deki/files/456/info"> <filename>myfile.jpg</filename> <description /> <contents type="image/pjpeg" size="53112" width="476" height="480" href="http://help.mindtouch.us/@api/deki/files/456" /> <contents.preview rel="thumb" type="image/pjpeg" maxwidth="160" maxheight="160" href="http://help.mindtouch.us/@api/deki/files/456?size=thumb" /> <contents.preview rel="webview" type="image/pjpeg" maxwidth="550" maxheight="550" href="http://help.mindtouch.us/@api/deki/files/456?size=webview" /> <date.created>2007-08-23T19:04:53Z</date.created> <user.createdby id="1" href="http://help.mindtouch.us/@api/deki/users/1"> <nick>Admin</nick> <username>Admin</username> <email>admin@mindtouch.com</email> </user.createdby> <revisions count="1" href="http://help.mindtouch.us/@api/deki/files/456/revisions" /> <page.parent id="29" href="http://help.mindtouch.us/@api/deki/pages/29"> <title>DekiWiki (Hayes)</title> <path /> </page.parent> </file>
Curl Code Sample: Delete File Description
The following command deletes a file description (file ID = 1):
Sample Code
curl -u username:password -X DELETE -i http://mindtouch.address/@api/deki/files/1/description
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
File ID = 71
HTTP Response Headers
HTTP/1.1 200 OK Date: Tue, 26 Jan 2010 21:33:05 GMT Server: Dream-HTTPAPI/2.0.0.17629 Microsoft-HTTPAPI/2.0 Content-Length: 2753 Content-Type: application/xml; charset=utf-8 X-Data-Stats: request-time-ms=129; mysql-queries=18; mysql-time-ms=89; X-Deki-Site: id="default" Via: 1.1 dekiwiki
HTTP Response Body
Content-Type: application/xml
<file id="71" revision="5" href="http://192.168.59.128/@api/deki/files/71/info"> <filename>trollface.jpg</filename> <description/> <contents type="image/jpg" size="88820" width="469" height="428" href="http://192.168.59.128/@api/deki/files/71/=trollface.jpg"/> <contents.preview rel="thumb" type="image/jpeg" maxwidth="160" maxheight="160" href="http://192.168.59.128/@api/deki/files/71/=trollface.jpg?size=thumb"/> <contents.preview rel="webview" type="image/jpeg" maxwidth="550" maxheight="550" href="http://192.168.59.128/@api/deki/files/71/=trollface.jpg?size=webview"/> <date.created>2010-01-21T22:49:09Z</date.created> <user.createdby id="1" href="http://192.168.59.128/@api/deki/users/1"> <nick>Admin</nick> <username>Admin</username> <email>admin@admin.com</email> <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email> <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar> </user.createdby> <revisions count="5" totalcount="5" href="http://192.168.59.128/@api/deki/files/71/revisions"/> <page.parent id="567" href="http://192.168.59.128/@api/deki/pages/567?redirects=0"> <uri.ui>http://192.168.59.128/FUBAR</uri.ui> <title>FUBAR</title> <path>FUBAR</path> <namespace>main</namespace> </page.parent> <properties count="2" href="http://192.168.59.128/@api/ deki/files/71/properties"> <property name="urn:deki.mindtouch.com#description" href="http://192.168.59.128/@api/deki/files/71/properties/urn%253adeki.mindtouch.com%2523description/info" etag="107.r2_ts2010-01-26T21:33:05Z"> <contents type="text/plain; charset=utf-8" size="0" href="http://192.168.59.128/@api/deki/files/71/properties/urn%253adeki.mindtouch.com%2523description"/> <date.modified>2010-01-26T21:33:05Z</date.modified> <user.modified id="1" href="http://192.168.59.128/@api/deki/users/1"> <nick>Admin</nick> <username>Admin</username> <email>admin@admin.com</email> <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email> <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar> </user.modified> </property> <property name="iscopyright" href="http://192.168.59.128/@api/deki/files/71/properties/iscopyright/info" etag="106.r2_ts2010-01-21T19:54:52Z"> <contents type="text/plain" size="3" href="http://192.168.59.128/@api/deki/files/71/properties/iscopyright">yes</contents> <date.modified>2010-01-21T19:54:52Z</date.modified> <user.modified id="1" href="http://192.168.59.128/@api/deki/users/1"> <nick>Admin</nick> <username>Admin</username> <email>admin@admin.com</email> <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email> <uri.gravatar>http://www.grav atar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar> </user.modified> <change-description/> </property> </properties> </file>