public. Retrieve file attachment information
| Name | Type | Description |
| fileid | int | identifies a file by ID |
| 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). |
| revision | string? | File revision to retrieve. 'head' by default will retrieve latest revision. positive integer will retrieve specific revision |
| Name | Value | Description |
| BadRequest | 400 | Invalid input parameter or request body |
| Forbidden | 403 | Read access to the page is required |
| NotFound | 404 | Requested file could not be found |
| Ok | 200 | The request completed successfully |
Output:
<file id="{int}" revision="{int}" href="{uri}">
<filename>{text}</filename>
<description>{text}</description>
<contents type="{mimetyp e}" size="{int}" width="{int}" height="{int}" href="{uri}" />
<contents.preview rel="thumb" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" revision="{int}" />
<contents.preview rel="webview" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" revision="{int}" />
<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>
The contents.preview element only exists if a file preview is available. Preview generation requires the file to be an image and fall within a certain size.
The following code example retrieves information about the file with ID 456:
Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("files", "456", "info").Get();
Sample response:
<file id="456" href="http://deki-hayes/@api/deki/files/456/info">
<filename>myfile.jpg</filename>
<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>