Overview
Retrieve file attachment information
- REST Method: GET
- 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. |
pageid |
string |
either an integer page ID, "home", or "=" followed by a double uri-encoded page path |
fileid |
int |
identifies a file by ID |
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). |
includeDeleted |
bool |
When fileid is an integer ID, and this parameter is set to true, we will even return the file info if it was deleted at some point |
revision |
string? |
File revision to retrieve. 'head' by default will retrieve latest revision. positive integer will retrieve specific revision |
Return Codes
Name |
Value |
Description |
OK |
200 |
The request completed successfully |
Bad Request |
400 |
Invalid input parameter or request body |
Forbidden |
403 |
Read access to the page is required |
Not Found |
404 |
Requested file could not be found |
Message Format
Output:
01 | < file id = "{int}" href = "{uri}" > |
02 | < filename >{text}</ filename > |
03 | < description >{text}</ description > |
04 | < contents type = "{mimetype}" size = "{int}" width = "{int}" height = "{int}" href = "{uri}" /> |
05 | < contents.preview rel = "thumb" type = "{mimetype}" maxwidth = "{int}" maxheight = "{int}" href = "{uri}" /> |
06 | < contents.preview rel = "webview" type = "{mimetype}" maxwidth = "{int}" maxheight = "{int}" href = "{uri}" /> |
07 | < date.created >{date}</ date.created > |
08 | < user.createdby id = "{int}" href = "{uri}" > |
10 | < username >{text}</ username > |
13 | < revisions count = "{int}" href = "{uri}" /> |
14 | < page.parent id = "{int}" href = "{uri}" > |
Implementation Notes
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.
C# Code Sample: Retrieve File Info
The following code example retrieves information about the file called "myfile.jpg" on the home page:
Sample Code
2 | p.At( "users" , "authenticate" ).WithCredentials( "admin" , "password" ).Get(); |
3 | p.At( "pages" , "home" , "files" , "=myfile%252ejpg" , "info" ).Get(); |
Sample Response from executing Code
02 | < filename >myfile.jpg</ filename > |
07 | < date.created >2007-08-27T19:59:24Z</ date.created > |
10 | < username >Admin</ username > |
11 | < email >admin@mindtouch.com</ email > |
15 | < title >DekiWiki (Hayes)</ title > |
Implementation notes
Add notes about requirements or config values
Curl Code Sample: Retrieve File Info
The following command retrieves metadata information of file "foo" attached to page "bar":
Sample Response from executing Code
Sample response of metadata for file "batman.xml", attached to page "Bar".
02 | < filename >batman.xml</ filename > |
05 | < date.created >2010-01-28T00:34:10Z</ date.created > |
08 | < username >Admin</ username > |
09 | < email hidden = "true" /> |
10 | < hash.email >64e1b8d34f425d19e1ee2ea7236d3028</ hash.email > |
18 | < namespace >main</ namespace > |
Implementation notes
curl flags
- -u
- Provides external user authentication. Note that if anonymous access is available and authentication is not forced, this flag may be omitted.
- -i
- Outputs the HTTP response headers. Useful for debugging.
Attached files
- To view a list of all files attached to a page, follow the instructions here.