Get Responsive Medium Image
/documents/api/1.2/files/{fileId}/data/mediumImage
Get a medium-sized rendition of the file. The image returned is not wider than 1024 pixels. If the rendition has not been created, this call will generate the rendition.
Request
- application/json
- application/xml
-
fileId: string
Globally unique identifier (GUID) for the file. The GUID must be a for jpeg, png, gif or tiff image.
-
format(optional): string
Specify the image type to return. The following types are supported:
jpeg
orjpg
returns a jpeg image. This is the default value.webp
returns a WebP image.
-
version(optional): string
Specify the version number of the file to use. If the version is not specified, the latest version is used.
-
accessToken(optional): string
Applink access token authorizing the current user to access the parent folder or this file. This parameter is mandatory if
appLinkID
is used. It can be used as accessToken or AccessToken. -
appLinkID(optional): string
Applink ID authorizing the current user to access the parent folder or this file. Any time the parameter
appLinkID
is used, a parameteraccessToken
must be provided as well. It can be used as appLinkID or AppLinkID. -
dAccessCode(optional): string
Access code needed to use protected public links. It needs to be sent as part of a Cookie header in the following format:
dAccessCode-<linkID>=<passcodeValue>
-
linkID(optional): string
Public link ID of a public link authorizing the current user to access this file. It can be used as linkID or LinkID.
Response
- image/jpeg
- image/webp
200 Response
Binary data stream for the responsive image.
403 Response
User does not have read permission to the file ID.
404 Response
File ID is not found, or in rare cases the converted image cannot be returned.
415 Response
File ID is not a jpeg, png, gif or tiff image.
Examples
The following example retrieves a medium-sized jpeg image of the latest version of the specified file. The returned image is not wider than 1024 pixels. If the status code indicates success (200
), the response includes a data stream that contains the image.
GET .../files/D21C7EAA30B5394DF4B3FAF223897F0989F871A58A5C/data/mediumImage
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
Example 2
The following example retrieves a medium-sized webp image of version 2 of the specified file. The image returned is not wider than 1024 pixels. If the status code indicates success (200
), the response includes a data stream that contains the image.
GET .../files/D3E2C64C386901BFC239EB7D394A94AF203799A93B9/data/mediumImage?version=2&format=webp
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
Example 3
The following example retrieves a medium-sized webp image of version 2 of the specified file, but the file is under a folder structure not owned by or shared with the current user. An access denied error message is returned.
GET .../files/D3E2C64C386901BFC239EB7D394A94AF203799A93B9/data/mediumImage?version=2&format=webp
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 403
JSON Response
{ "errorCode": "-20", "errorKey": "!csUnableToDownloadFile!csCloudItemInsufficientPrivileges,DefaultTenant.UserA,fFileGUID:DD3E2C64C386901BFC239EB7D394A94AF203799A93B9,GET_ALTERNATE_IMAGE", "errorMessage": "Unable to download file. User 'User AA' has insufficient privilege to access fFileGUID:DD3E2C64C386901BFC239EB7D394A94AF203799A93B9 with service GET_ALTERNATE_IMAGE.", "errorType": "file", "format": "webp", "id": "DD3E2C64C386901BFC239EB7D394A94AF203799A93B9", "rendition": "Medium", "title": "Unable to download file. User 'User AA' has insufficient privilege to access fFileGUID:DD3E2C64C386901BFC239EB7D394A94AF203799A93B9 with service GET_ALTERNATE_IMAGE.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 4
The following example retrieves a medium-sized webp image of version 2 of the specified file, but the file ID is not valid.
GET .../files/DD3B2C64C386901BFC239EB7D394A94AF203799A93B9/data/mediumImage?version=2&format=webp
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 404
JSON Response
{ "errorCode": "-16", "errorKey": "!csUnableToDownloadFile!csSecurityValidationFailed!csFldDoesNotExist,DD3B2C64C386901BFC239EB7D394A94AF203799A93B9!csSystemError,\\!csFldDoesNotExist\\,DD3B2C64C386901BFC239EB7D394A94AF203799A93B9", "errorMessage": "Unable to download file. Security validation failed. 'DD3B2C64C386901BFC239EB7D394A94AF203799A93B9' does not exist. (System Error: 'DD3B2C64C386901BFC239EB7D394A94AF203799A93B9' does not exist.)", "errorType": "file", "format": "webp", "id": "DD3B2C64C386901BFC239EB7D394A94AF203799A93B9", "rendition": "Medium", "title": "Unable to download file. Security validation failed. 'DD3B2C64C386901BFC239EB7D394A94AF203799A93B9' does not exist. (System Error: 'DD3B2C64C386901BFC239EB7D394A94AF203799A93B9' does not exist.)", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "version": "2" }
Example 5
The following example retrieves a medium-sized jpeg of version 4 of the specified file. The image returned is not wider than 1024 pixels. If the status code indicates success (200
), the response includes a data stream that contains the jpeg image. The example uses a public link ID protected by an access code because this file is under a folder structure not owned by or shared with the current user. An access code (test12345
) is submitted as part of a Cookie in the request header.
GET .../files/D3E2C64C386901BFC239EB7D394A94AF203799A93B9/data/mediumImage?version=4
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518 Cookie: dAccessCode-LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518=test12345
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
Example 6
The following example retrieves a medium-sized jpeg of version 2 of the specified file. The image returned is not wider than 1024 pixels. If the status code indicates success (200
), the response includes a data stream that contains the jpeg image. The example uses an applink ID because this file is under a folder structure not owned by or shared with the current user. The applink ID and access token are submitted in the request header.
GET .../files/D3E2C64C386901BFC239EB7D394A94AF203799A93B9/data/mediumImage?version=2
Request Header
appLinkID: LF5Bxj4TPo_p4n4qWn0tbKTicR2cTUJKv7X_ng9E7ry93rRuDokPqS1d6-wKwhb_wtcGYFDsI_cNMxeKQ-HR-FXQhiVoGRTYM_MPZY8qpICfYU94mmnMjM_cvsRhKMzc0NJgvwEJfqqDwPsAVrhc8cmg== accessToken: 352FpiMmW66PeYI1Gh5b83I9CXRwZhLfYAu4TXdqpzD8uNKUBMZVVJ3ZvivUW8kQ
Request Body
None.
HTTP Status Code
HTTP_STATUS = 200
Example 7
The following example retrieves a medium-sized webp of the latest version of the specified file ID, but the file ID is not a jpeg, png, gif or tiff image. So an "Unsupported Media Type" error is returned.
GET .../files/DAFEF814943F5A3A1E6AC6AED394A94AF203799A93B9/data/mediumImage?format=webp
Request Header
None.
Request Body
None.
HTTP Status Code
HTTP_STATUS = 415
JSON Response
{ "errorCode": "-30", "errorKey": "!csUnableToDownloadFile!csZipRenditionNotAnImage", "errorMessage": "Unable to download file. Responsive images cannot be created for non image files.", "title": "Unable to download file. Responsive images cannot be created for non image files.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }