Get Responsive Small Image

get

/documents/api/1.2/files/{fileId}/data/smallImage

Get a small-sized rendition of the file. The image returned is not wider than 300 pixels. If the rendition has not been created, this call will generate the rendition.

Request

Supported Media Types
Path Parameters
  • Globally unique identifier (GUID) for the file. The GUID must be for a jpeg, png, gif or tiff image.

Query Parameters
  • Specify the image type to return. The following types are supported:

    • jpeg or jpg returns a jpeg image. This is the default value.
    • webp returns a WebP image.

  • Specify the version number of the file to use. If the version is not specified, the latest version is used.

Header Parameters
  • 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.

  • Applink ID authorizing the current user to access the parent folder or this file. Any time the parameter appLinkID is used, a parameter accessToken must be provided as well. It can be used as appLinkID or AppLinkID.

  • 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>

  • Public link ID of a public link authorizing the current user to access this file. It can be used as linkID or LinkID.

Back to Top

Response

Supported Media Types

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 supported image (jpeg, png, gif, bmp or tiff) or document type (doc, docx, xls, xlsx, ppt, pptx or pdf).

Back to Top

Examples

The following example retrieves a small-sized jpeg image of the latest version of the specified file. The returned image is not wider than 300 pixels. If the status code indicates success (200), the response includes a data stream that contains the image.

GET .../files/D21C7EAA30B5394DF4B3FAF223897F0989F871A58A5C/data/smallImage

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 200

Example 2

The following example retrieves a small-sized webp image of version 2 of the specified file. The image returned is not wider than 300 pixels. If the status code indicates success (200), the response includes a data stream that contains the image.

GET .../files/D3E2C64C386901BFC239EB7D394A94AF203799A93B9/data/smallImage?version=2&format=webp

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 200

Example 3

The following example retrieves a small-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/smallImage?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": "Small",
    "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 small-sized webp image of version 2 of the specified file, but the file ID is not valid.

GET .../files/DD3B2C64C386901BFC239EB7D394A94AF203799A93B9/data/smallImage?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": "Small",
    "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 small-sized jpeg of version 4 of the specified file. The image returned is not wider than 300 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/smallImage?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 small-sized jpeg of version 2 of the specified file. The image returned is not wider than 300 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/smallImage?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 small-sized webp of the latest version of the specified file ID, but the file ID is not a supported image or document type. So an "Unsupported Media Type" error is returned.

GET .../files/DAFEF814943F5A3A1E6AC6AED394A94AF203799A93B9/data/smallImage?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"
}
Back to Top