MindTouch Developer Center > MindTouch Deki > API Reference > PUT:pages/{pageid}/files/{filename}/description

Overview

public. Update attachment description

Uri Parameters
NameTypeDescription
filenamestring"=" followed by a double uri-encoded file name
pageidstringeither an integer page ID, "home", or "=" followed by a double uri-encoded page title
Query Parameters
NameTypeDescription
redirectsint?If zero, do not follow page redirects (only applies when {pageid} is present).
Return Codes
NameValueDescription
BadRequest400Invalid input parameter or request body
Forbidden403Update access to the page is required
NotFound404Requested file could not be found
Ok200Request completed successfully

Message Format

Input:
Content-type=text/plain

Output:

<file id="{int}" href="{uri}">
    <filename>{text}</filename> 
    <description>{text}</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/{fileid}/description to retrieve the file description.

Code Samples

The following code example sets the description of the file "myfile.jpg" on the home page:

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
DreamMessage msg = DreamMessage.Ok(MimeType.TEXT, "New description text");
p.At("pages", "home", "files", "=myfile%252ejpg", "description").Put(msg);

Sample response indicating that the description was successfully set:

<file id="456" href="http://deki-hayes/@api/deki/files/456/info">
    <filename>myfile.jpg</filename> 
    <description>New description text</description> 
    <contents type="image/pjpeg" size="53112" width="476" height="480" href="http://deki-hayes/@api/deki/files/456" /> 
    <contents.preview rel="thumb" type="image/pjpeg" maxwidth="160" maxheight="160" href="http://deki-hayes/@api/deki/files/456?size=thumb" /> 
    <contents.preview rel="webview" type="image/pjpeg" maxwidth="550" maxheight="550" href="http://deki-hayes/@api/deki/files/456?size=webview" /> 
    <date.created>2007-08-27T19:59:24Z</date.created> 
    <user.createdby id="1" href="http://deki-hayes/@api/deki/users/1">
        <nick>Admin</nick> 
        <username>Admin</username> 
        <email>admin@mindtouch.com</email> 
    </user.createdby>
    <revisions count="2" href="http://deki-hayes/@api/deki/files/456/revisions" /> 
    <page.parent id="29" href="http://deki-hayes/@api/deki/pages/29">
        <title>DekiWiki (Hayes)</title> 
        <path /> 
    </page.parent>
</file>
Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.1