POST /documentprocessing/document/thumbnails
POST https://example.com/documentprocessing/document/thumbnails
Description
Creates and returns thumbnail images of documents.
Examples
The following sample creates thumbnail images of a given document for page 1 and 2.
# Request:
curl POST 'https://trial.dsserver.io/documentprocessing/document/thumbnails?imageFormat=PNG' \
'Content-Type: application/json' \
'Authorization: Bearer GphAd1R0npJM9OuX2y9mUa4cfqPMOg6p' \
'"eAUBAA4AAAAAAAAAAAAOAAAAVFhUZXh0Q29udHJvbDEAXAEAAA[..]="'
# Result:
[
"iVBORw0KGgoAAAANSUhEUgAA[..]",
"iVBORw0KGgoAAAANSUhEUgAA[..]"
]
Authorization
This endpoint supports the OAuth authorization method. DS Server checks the access token only when OAuth is enabled in the admin portal (see Enable OAuth). With OAuth disabled, the default of a new installation, the endpoint accepts requests without a token.
DS Server implements OAuth as the authorization method. Two flows are supported:
- Authorization Code
- Client Credentials
To use the Client Credentials flow, switch on Allow “Client Credentials” grant type in the security profile (see OAuth Grant Types).
In both cases, a valid access token returned from the OAuth endpoints must be passed in a Bearer Authorization Header, as a Query Parameter or in a Cookie.
Authorization Header
| Header field | Description |
|---|---|
| Authorization | A Bearer authorization header (also called token authentication) contains the OAuth access token. The authorization method and a space i.e. "Bearer " is then put before your valid access token. For example: Authorization: Bearer 4796E23054E64BC773CACBCAF24AD179DE9A3 |
Query Parameter
| Query parameter | Description |
|---|---|
| access_token | The access token is passed directly in the endpoint URL as a query string. For example: ?access_token=4796E23054E64BC773CACBCAF24AD179DE9A3 |
Cookie
| Cookie | Description |
|---|---|
| access_token | The access token is passed in a cookie named access_token. For example: Cookie: access_token=4796E23054E64BC773CACBCAF24AD179DE9A3 |
Request Parameters
| Name | Type | Value | Optional |
|---|---|---|---|
| zoomFactor | Integer | An Integer value between 1 and 400 to set the percentage zoom factor of the created thumbnail images. Default value is 100. | yes |
| fromPage | Integer | An Integer value that specifies the first page. By default the first page is selected. Default value is 1. | yes |
| toPage | Integer | An Integer value that specifies the last page. By default the last page is selected. Default value is 0. | yes |
| imageFormat | String | A string value that defines the image format of the returned thumbnails. Possible values are "PNG", "JPG", "GIF", "BMP" and, since version 3.2.0, "SVG". On Linux, the Core build renders SVG only. Default value is "PNG". | yes |
| maxImageResolution | Integer | An Integer value that specifies the maximum image resolution in dots per inch. The .NET client sends 96 unless another value is passed. | yes |
Request Payload
| Type | Value |
|---|---|
| String | A document encoded as a Base64 string. Supported formats are DOC, DOCX, PDF, TX, XLSX, RTF and HTML. |
Success Response
| Status | Description |
|---|---|
| 200 | On success, the HTTP status code in the response header is 200 (OK). The response body contains a string array of Base64 encoded images in the selected format. |
Error Response
| Status | Description |
|---|---|
| 401 | A 401 (Unauthorized) with an empty body is returned, if OAuth is enabled and the request has no valid access token. |
| 400 | A 400 (Bad Request) is returned, if the body can't be read as a JSON string ("The JSON value could not be converted to System.String.") or a query parameter has a value of the wrong type, for example zoomFactor=abc. The body is a problem details object (application/json) with the title "One or more validation errors occurred." and the message per field in errors. This check comes before the license check. |
| 415 | A 415 (Unsupported Media Type) is returned, if the Content-Type header of a request with a body is not application/json. |
| 405 | A 405 (Method Not Allowed) with an empty body and the header Allow: POST is returned for any other HTTP method, for example GET. |
| 400 | A 400 (Bad Request) is returned, if DS Server is not licensed or the license is invalid. On a server that is not registered, the body is the JSON string "DS Server is not registered." (application/json). DS Server checks the license before the parameter values, but after it has read the body and the typed query parameters. |
| 400 | A 400 (Bad Request) is returned, if the image format is not supported. |
| 400 | A 400 (Bad Request) is returned, if no document has been found in the body. |
| 400 | A 400 (Bad Request) is returned, if the given page numbers are invalid. |
| 400 | A 400 (Bad Request) is returned, if the uploaded document is not valid. |