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/content


Request Headers

ParameterDescriptionRequired
Accept-EncodingMy 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
AuthorizationAn 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-MatchA 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-MatchA previous response ETag or *. Returns the object only if its entity tag (ETag) is different from the one specified.

Value of type: string
false
RangeThe byte range of an object to download.

Value of type: range-request
false


Request Path Parameters

ParameterDescriptionRequired
idThe file ID or the alias root.

Value of type: string
true


Request Query Parameters

ParameterDescriptionRequired
access_tokenAn 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
allowOriginalAllow/disallow the original to potentially be served as the preview image.

Value of type: boolean

Default: true
false
allowTemporaryAllow/disallow the temporary to potentially be served as the preview image.

Value of type: boolean

Default: true
false
cacheBustValueA placeholder parameter clients can use for their own url based cache invalidation.false
cacheControlMaxAgeA client controlled max-age value for the Cache-Control response header.

Value of type: integer
false
downloadWhether 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
minHeightThe minHeight of the preview image.

Value of type: integer
false
minWidthThe minWidth of the preview image.

Value of type: integer
false


200 Response

OK

Response Headers

ParameterDescriptionRequired
Content-TypeThe Media Type (MIME type) of the file.false
EtagAn eTag (entity tag) is an HTTP response header used to determine the change in file metadata and content.false


Response Payload

ParameterDescriptionRequired
contentThe 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