Download a file's content or thumbnail
Download the content of a regular file. Fetch thumbnails for mediafiles (image, audio, video).
Endpoint URL: {network.internalDNSName or network.proxyURL} received in DeviceInformation
Image preview
Use minWidth and minHeight along with allowOriginal to control itsdimensions. The image's original aspect ratio is always preserved. For an image larger than the given dimensions, the preview of the original image size is returned. In case the image is smaller than the given dimensions, the image returned will be of original size. A temporary preview image is returned irrespective of minWidth and minHeight if allowTemporary is true and a non-temporary preview is not available yet. Previews are always pre-rotated. Passing a minWidth or minHeight over 1080 is likely to return a preview for the original image size.
Request Syntax
GET /v2/files/:id/contentRequest Headers
| Parameter | Description | Required |
|---|---|---|
| Accept-Encoding | My Cloud Home API can compress response data which reduces network traffic and improves response time. Responses are compressed if request is made using the Accept-Encoding header, with a value of gzip. Value of type: string | false |
| Authorization | An access token with nas_read_only or nas_read_write scope as well as the File Permission with value ReadFile or FileOwner for the file or a parent.Value of type: string | true |
| If-Match | A previous response ETag or *. Returns the object only if its entity tag (ETag) is the same as the one specified. Value of type: string | false |
| If-None-Match | A previous response ETag or *. Returns the object only if its entity tag (ETag) is different from the one specified. Value of type: string | false |
| Range | The byte range of an object to download. Value of type: range-request | false |
Request Path Parameters
| Parameter | Description | Required |
|---|---|---|
| id | The file ID or the alias root.Value of type: string | true |
Request Query Parameters
| Parameter | Description | Required |
|---|---|---|
| access_token | An access token with nas_read_only or nas_read_write scope as well as the File Permission with value ReadFile or FileOwner for the file or a parent.Value of type: string | true |
| allowOriginal | Allow/disallow the original to potentially be served as the preview image. Value of type: boolean Default: true | false |
| allowTemporary | Allow/disallow the temporary to potentially be served as the preview image. Value of type: boolean Default: true | false |
| cacheBustValue | A placeholder parameter clients can use for their own url based cache invalidation. | false |
| cacheControlMaxAge | A client controlled max-age value for the Cache-Control response header.Value of type: integer | false |
| download | Whether to send the Content-Disposition attachment header. The Content-Disposition header indicates if the content is expected to be displayed as an attachment that is downloaded and saved locally. Value of type: boolean Default: false | false |
| minHeight | The minHeight of the preview image. Value of type: integer | false |
| minWidth | The minWidth of the preview image. Value of type: integer | false |
200 Response
OKResponse Headers
| Parameter | Description | Required |
|---|---|---|
| Content-Type | The Media Type (MIME type) of the file. | false |
| Etag | An eTag (entity tag) is an HTTP response header used to determine the change in file metadata and content. | false |
Response Payload
| Parameter | Description | Required |
|---|---|---|
| content | The content of file. | true |
Example (Thumbnail)
Sample request to fetch a thumbnail for a file.Request
GET /sdk/v2/files/oYkPWXdV1YvELf8Ta-PXI5agunJQr-w6KyEmskwk/content?minWidth=80&minHeight=100 HTTP/1.1Host: Endpoint-URLAuthorization: Bearer 9e9d3d16-f9b1-43dc-8599-d1db6fcedfa9
Response
HTTP/1.1 200 OKAccept-Ranges: bytesContent-Type: image/jpegEtag: "Bg"Vary: OriginDate: Mon, 29 Aug 2016 21:52:30 GMTTransfer-Encoding: chunkedfile content