ReportingCloud

GET /v1/templates/thumbnails

Endpoint

GET https://api.reporting.cloud/v1/templates/thumbnails

Description

Renders the pages of a template in the template storage as images. The query names the template and selects the pages (fromPage and toPage, all pages by default), the size (zoomFactor, 100 percent by default) and the image format (imageFormat, PNG by default). The response is an array with one Base64 image per page. For a document that isn't stored, use POST /v1/document/thumbnails. See Thumbnails.

Warning

Document Quota. Each successful request counts 1 against the document quota. It counts 1 also when it renders several pages. Plans and Licensing lists the quota of each plan.

Examples

Request:

curl -u username:password \
  -X GET "https://api.reporting.cloud/v1/templates/thumbnails?templateName=sample_invoice.tx&zoomFactor=80&fromPage=1&toPage=1"

Results:

["iVBORw0KGgoAAAANSUhEUgAAAo...mCC"]

Authorization

This endpoint requires a "ReportingCloud-APIKey" or a "Basic" user authorization to access the user account, data and templates. Only one of these two methods is required.

API Keys describes how to create an API key, and Authentication explains both header forms.

ReportingCloud-APIKey

Header fieldDescription
AuthorizationRequired. A valid ReportingCloud account is required. The Authorization field is constructed as follows: An API key needs to be generated in the portal or with PUT /v1/account/apikey. The authorization method and a space, "ReportingCloud-APIKey ", is then put before the actual API key string. For example: Authorization: ReportingCloud-APIKey oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI

Basic

Header fieldDescription
AuthorizationRequired. A valid ReportingCloud account is required. The Authorization field is constructed as follows: The user name and password are combined into a string separated by a colon, for example username:password. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space, "Basic ", is then put before the encoded string. For example: Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

Request Parameters

NameTypeValueOptional
templateNameStringThe filename of the template in the template storage. The name is matched case-insensitively.no
zoomFactorIntegerAn Integer value between 10 and 400 to set the percentage zoom factor of the created thumbnail images. At 100, a page is rendered at 96 dpi. Default value: 100.yes
fromPageIntegerAn Integer value that specifies the first page, from 1 to the number of pages. By default the first page is selected.yes
toPageIntegerAn Integer value that specifies the last page, up to the number of pages. 0 selects the last page, and so does leaving it out.yes
imageFormatStringA string value that defines the image format of the returned thumbnails. Possible values are PNG, JPG, GIF and BMP, in upper or lower case. By default, the return format is PNG.yes

Success Response

StatusDescription
200On 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, one per page, in page order. If fromPage is greater than toPage, the body is null, and the request still counts against the document quota.

Error Response

StatusDescription
400A 400 (Bad Request) is returned, if the template doesn't exist in the template storage or templateName is empty, if zoomFactor is not between 10 and 400 or fromPage is less than 1 ("Template not valid"), if fromPage or toPage is past the last page ("Page numbers not valid"), if imageFormat is not one of the possible values ("The image format is not supported"), or if zoomFactor, fromPage or toPage is empty.
403A 403 (Forbidden) is returned, if the user is not authorized or the document quota is exceeded.
404A 404 (Not Found) is returned, if a required query parameter is missing.
405A 405 (Method Not Allowed) is returned, if the request uses another HTTP method than GET. The Allow header of the response names GET.
500A 500 (Internal Server Error) is returned, if the request has no Authorization header, an empty one or one that is not the authorization method, a space and the credentials, or if imageFormat is empty.

Timeout Limitation. The pure processing time is limited to a maximum of 60 seconds. After this period of time, the task is canceled.

A typical document should not take more than 5 seconds. If your request takes longer, reduce the size of the template or the number of pages.