files/{fileid}/properties/{key} (GET)
Overview
Retrieve the content of an attachment property
- REST Method: GET
- Method Access: public
Uri Parameters
Name | Type | Description |
key | string | A unique identifier for a property that is obtained through GET:files/{fileid}/properties |
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. |
Return Codes
Name | Value | Description |
OK | 200 | The request completed successfully |
Bad Request | 400 | Invalid input parameter or request body |
Forbidden | 403 | READ access is required |
Not Found | 404 | Requested file and/or property could not be found |
Message Format
Response is the etag, content-length, content-type, and body of the property.
Implementation Notes
- READ access to the page is required to get the contents of a file property
C# Code Sample: Retrieve Value of a File Property
The following code authenticates and retrieves the value of a text based file property named 'foo' .
Sample Code
Plug p = Plug.New("http://devwiki/@api/deki"); p.At("users", "authenticate") .WithCredentials("sysop", "password").Get(); string val = p.At("files", "42", "properties", "foo") .Get().AsText();
Implementation notes
Add notes about requirements or config values
Curl Code Sample: Retrieve Value of a File Property
The following command retrieves property "foo" assigned to file with file ID = 1:
Sample Code
curl -u username:password -i http://mindtouch.address/@api/deki/files/1/properties/foo
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.
Response
- Note that a file, not an XML document, is returned. So if an image or any non-text file is assigned as the property's value, a bunch of junk will very possibly be returned to the console.