Downloading a file attachment
Download a file attachment from your library programmatically.See Authenticating requests for information about how to authenticate the request.
Table 1. Atom API request details
Method Resource address Output representation Description GET Construct the address using the following URL:/basic/api/myuserlibrary/document/{document-id}/attachment/{attachment-id}/media/{attachment-label} binary media Returns a file attachment from your library. This request requires authentication. Use this URI to retrieve the binary data if you plan to update and return it using a PUT request.
Note: {document-id} is the value of the <td:uuid> or <td:label> element in the Atom entry document of the file with the attachment. {attachment-id} is the value of the <td:uuid> or <td:label> elements in the attachment's Atom entry document.You can use one or more of these headers.
Table 2. Input headers
Parameter Description If-Modified-Since Used to validate the local cache of the feed and entry documents retrieved previously. If the feed or entry has not been modified since the specified date, HTTP response code 304 (Not Modified) is returned. If-None-Match Contains an ETag response header sent by the server in a previous request to the same URL. If the ETag is still valid for the specified resource, HTTP response code 304 (Not Modified) is returned. You can use the following input parameter.
Table 3. Input parameters
Parameter Description identifier Indicates how the document is identified in the {document-id} variable segment of the web address. By default, the lookup operation is performed with the expectation that the URL contains the value from the <td:uuid> element of a document Atom entry, so the value uuid is used. Specify label if the URL instead contains the value from the <td:label> element of a document Atom entry.
Input
None.
Output
Binary content of the file.Returned HTTP headers
HTTP/1.1 200 OK
Indicates that the file attachment was successfully downloaded. If an error occurs, this header contains one of the error codes.
- HTTP/1.1 401 Unauthorized
- HTTP/1.1 403 Forbidden
- HTTP/1.1 404 Not Found
Parent topic
Work with file attachments programmaticallyRelated reference
File attachment content
});