Export workbook canvas

post

/api/20210901/catalog/workbooks/{urlBase64WorkbookId}/exports

Initiate an export of a workbook canvas to PDF or PNG. Returns a work request ID.

Request

Path Parameters
Supported Media Types
Request Body - application/json ()
Root Schema : schema
Match All
Show Source
Nested Schema : ExportBasePayload
Type: object
Show Source
Nested Schema : type
Type: object
Show Source
Nested Schema : canvasIds
Type: array
A list of canvas IDs.
Show Source
Back to Top

Response

202 Response

Asynchronous operation started.
Headers

400 Response

Bad Request (invalid query parameters, malformed headers, and so on).
Body ()
Root Schema : Error
Type: object
Show Source

401 Response

Unauthorized (missing or expired credentials, and so on).
Body ()
Root Schema : Error
Type: object
Show Source

403 Response

Forbidden (missing permissions for operation, request denied for unspecified reason, and so on).
Body ()
Root Schema : Error
Type: object
Show Source

404 Response

Not Found. The requested resource was not found.
Body ()
Root Schema : Error
Type: object
Show Source

412 Response

Precondition Failed. One or more preconditions are not satisfied for the operation to proceed.
Body ()
Root Schema : Error
Type: object
Show Source

422 Response

Unprocessable Entity. Unable to proceed the operation, though the request entity was correct.
Body ()
Root Schema : Error
Type: object
Show Source

500 Response

Internal Server Error. The server encountered an unexpected condition preventing fulfilment of the request.
Body ()
Root Schema : Error
Type: object
Show Source
Back to Top

Examples

To export canvases from a workbook or PDF or PNG, you need to create a payload that contains the following information:
  • name: The output file name.
  • type: Output type. Type must be file.
  • canvasIds: IDs of the canvases in the workbook. Maximum 5 canvases. Maximum length of a canvasId is 2000 characters.
  • format: Output format. Format must be PDF or PNG.
  • screenwidth: Browser screen width. Maximum width is 3600.
  • screenheight: Browser screen height. Maximum height is 3600.
Here's an example JSON file, named payload.json:
{
    "name": "Monthly report",
    "type": "file",
    "canvasIds": ["snapshot!canvas!1", "snapshot!canvas!2"],
    "format": "pdf",
    "screenwidth": 1440,
    "screenheight": 900
}

Example - Request PDF Output from a Workbook with a JSON Payload

In this example, you request a PDF with two canvases from an existing workbook with the given ID using the JSON file payload.json. The object ID of the workbook is '/shared/Sales/MySalesWorkbook' which has the Base64URL-safe encoded ID value: L3NoYXJlZC9TYWxlcy9NeVNhbGVzV29ya2Jvb2s. You can get the ID of a workbook by using Get catalog items by type.

Successful operation returns a work request ID, which in the example response is biwj-J2MwOjQwOCcuJ2N3Ojc4NSc. You can check the status of your export request by passing the work request ID to Get a work request item. Work request IDs are also referred to as export IDs.

cURL Example:

curl    --header 'Authorization: Bearer <token>'    
            --header 'Content-Type: application/json'   
         --request POST 'http://<hostname>:<port>/api/20210901/catalog/workbooks/L3NoYXJlZC9TYWxlcy9NeVNhbGVzV29ya2Jvb2s/exports/
         --data @payload.json'

Example of Request Body

Not applicable.

Example of Response Body

{
    "resourceUri": "/api/20210901/catalog/workbooks/L3NoYXJlZC9TYWxlcy9NeVNhbGVzV29ya2Jvb2s/exports/biwj-J2MwOjQwOCcuJ2N3Ojc4NSc"
}
Back to Top