Evangelos Malandrakis
04/14/2025, 10:39 AMFrancisco Antunes
04/14/2025, 3:31 PMexport_pdf
method, or the API to export a Dashboard. Are you looking for the same use-case?
Since then, our developers have released the Tabular exports to PDF feature, which is described on this Apiary Entry, and is a lot more detailed on how to structure the body of the JSON. Would you kindly take a look there?Evangelos Malandrakis
04/14/2025, 3:37 PMmetadata
field for this use case. What type of object is expected withing the metadata
field: the filter context id along with the local identifier of the filter? Not sure if my point is clear, but I can provide an example if needed.Francisco Antunes
04/14/2025, 3:53 PMcurl -X POST https://{{baseUrl}}/api/v1/actions/workspaces/894c6276e4bd41d89084db8a6e8688a8/export/visual -H "Authorization: Bearer xxxxx" -H 'Content-type: application/json' -d '{"fileName":"Different filter","dashboardId":"4fb95767-9368-4536-a890-f6119086e577","metadata":{"filters":[{"dateFilter":{"from":-1,"granularity":"GDC.time.year","to":-1,"type":"relative"}},{"attributeFilter":{"attributeElements":{"uris":["Jasmine"]},"displayForm":{"identifier":"NAME","type":"displayForm"},"negativeSelection":false,"localIdentifier":"465a183c6cab4bf4a
d9783760cc21bc0","selectionMode":"multi"}}]}}'
It’s basically the same syntax as it would be on the dashboard’s JSON definition. So you can easily trial-and-error it by modifying a dashboard to have the filters you would want to use, and call the Get a Dashboard endpoint - it will give you the filter IDs and proper syntax to apply on the Visual Export API calls 🙂Evangelos Malandrakis
04/14/2025, 3:58 PMEvangelos Malandrakis
04/14/2025, 6:06 PM{
"data": {
"id": "6a7f0763-bb43-495e-9445-6ae260d90198",
"type": "analyticalDashboard",
"attributes": {
"title": "Self invoice attachment",
"description": "",
"content": {
"dateFilterConfig": {
"filterName": "",
"mode": "readonly"
},
"filterContextRef": {
"identifier": {
"id": "924d988f-ec4c-4c14-ab5c-59597fcc4885",
"type": "filterContext"
}
},
"layout": {},
"version": "2"
},
"createdAt": "2025-04-08 00:53",
"modifiedAt": "2025-04-14 17:35"
},
"meta": {
"origin": {
"originType": "NATIVE",
"originId": "dev.master"
}
}
}
}
So I tried to send a export PDF request using the body below and I got an accepted status (201 Created). But when I try to access the PDF, I get 202 Accepted without the PDF file appearing.
{
"dashboardId": "6a7f0763-bb43-495e-9445-6ae260d90198",
"fileName": "attachment.pdf",
"metadata": {
"filters": [
{
"dateFilter": {
"from": "2024-11-01 00:00",
"granularity": "GDC.time.date",
"to": "2024-11-30 23:59",
"type": "absolute"
}
},
{
"attributeFilter": {
"attributeElements": {
"uris": [
"Ästad Vingård"
]
},
"displayForm": {
"identifier": {
"id": "D_SITES.SITE_NAME",
"type": "label"
}
},
"localIdentifier": "D_SITES.SITE_NAME_1_attributeFilter",
"negativeSelection": false,
"selectionMode": "multi"
}
}
]
}
}
My guess is that the problem is associated with the fact that the dashboard doesn't have direct filters but filterContext
instead.
Any ideas of how I can overcome this? 😊Francisco Antunes
04/15/2025, 9:21 AM202
status code indicates that the resource is still processing the request (i.e.: generating the PDF). Have you tried giving it more time and polling it again later?Evangelos Malandrakis
04/15/2025, 9:24 AMFrancisco Antunes
04/15/2025, 9:26 AMEvangelos Malandrakis
04/15/2025, 9:26 AMFrancisco Antunes
04/15/2025, 2:00 PM{
"dashboardId": "092929af-375a-4e9c-964f-2add8cdbd259",
"fileName": "PDF-export-test",
"metadata": {
"filters": [
{
"relativeDateFilter": {
"dataSet": {
"identifier": {
"id": "date",
"type": "dataset"
}
},
"granularity": "GDC.time.year",
"from": 0,
"to": 0
}
}
]
}
}
Note that the filename doesn’t contain .pdf
. Would you kindly give something similar a try? With a very simple filter - and let me know how it goes 😉Evangelos Malandrakis
04/15/2025, 2:03 PMEvangelos Malandrakis
04/29/2025, 2:23 PMFrancisco Antunes
04/29/2025, 2:24 PM