Returns the content a given attachment.
You can get a public, tokenized URL to the file's content instead of the content itself. To do so, just specify text/uri-list as the value of the Accept: header in your HTTP request:
The URL returned is a public URL that doesn't require authentication or OAuth signatures. You can redirect users to it to trigger a download from their browser. That way, you don't have to download the data to your app server only to stream it back to your user.
The URL is valid for a 2 minute period after the time it has been generated. There is no limit to the number of downloads until the URL expires.
GET /2.0/accounts/4f01234567890abcdef09876/files/4f00987654321fedcba01234/content HTTP/1.1 Host: api.context.io Accept: text/uri-list Authorization: OAuth oauth_consumer_key="abcdef1234",oauth_version="1.0",oauth_timestamp="1327695986",oauth_nonce="6dPrHNDrx5hzfHkn",oauth_signature_method="HMAC-SHA1",oauth_signature="MFOyvf5Ykcsn7une48kGW0Aharw%3D"
The response to this call would like this:
HTTP/1.1 200 OK Date: Thu, 12 Apr 2012 18:31:17 GMT Content-Length: 145 Content-Type: text/uri-list https://some.domain.com/_cache/1234567890abCdGx?AWSAccessKeyId=ABCDEFGHIJKLMNOPQRST&Expires=1335221488&Signature=caxuBqBvc%2BKgmoSwDqMrUIyC9Ws%3D
If you're having trouble setting HTTP headers when creating requests in your code, we also support this feature as a GET parameter:
|as_link||integer||Set this parameter to 1 to get a tokenized public link to download the file rather than the content itself. This is an alternative to setting Accept: text/uri-list in the request headers and will return the exact same response.|
Since we do not keep full copies of attachments on our servers, the file has to be retrieved from the IMAP server before a response is returned. This is true whether you're asking for a tokenized public link to the content or requesting the content itself. If the IMAP server is unreachable at the time the call is made, this call will return an error.