You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "alex1404 (via GitHub)" <gi...@apache.org> on 2025/05/27 11:27:28 UTC
[D] Download dashboard as an image using API [superset]
GitHub user alex1404 created a discussion: Download dashboard as an image using API
Hi all, Was anyone able to download dashboard as an image using API? If yes ,please share the steps.
GitHub link: https://github.com/apache/superset/discussions/33589
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Download dashboard as an image using API [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] edited a comment on the discussion: Download dashboard as an image using API
<!-- Answer -->
Yes, it is possible to download a dashboard as an image using the API in Apache Superset.
### Steps to Download a Dashboard as an Image via API
1. **Identify the Dashboard ID and Digest**
- You need the dashboard's primary key (`pk`) and a unique hex digest (`digest`) for the dashboard. The digest is used to identify the specific state of the dashboard.
2. **API Endpoint**
- Use the following endpoint to request the dashboard image:
```
GET /api/v1/dashboard/{pk}/thumbnail/{digest}/
```
Replace `{pk}` with your dashboard's ID and `{digest}` with the appropriate digest value.
3. **Expected Responses**
- **HTTP 200**: Returns the dashboard thumbnail image in binary format (image).
- **HTTP 202**: The thumbnail does not exist in the cache; the server will start generating it asynchronously. You may need to retry after a short wait.
[See API details](https://github.com/apache/superset/blob/master/docs/static/resources/openapi.json)
4. **Authentication**
- Make sure your API request is authenticated (e.g., using a session cookie or Bearer token, depending on your Superset setup).
5. **Example Request (using `curl`):**
```bash
curl -X GET \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
"https://<your-superset-domain>/api/v1/dashboard/<pk>/thumbnail/<digest>/"
--output dashboard.png
```
6. **Handling Asynchronous Generation**
- If you receive a 202 response, wait a few seconds and retry the request until you receive the image (HTTP 200).
### Notes
- The thumbnail image represents the dashboard's current state as rendered in the UI.
- The digest parameter ensures you get the correct version of the dashboard. If you are unsure how to obtain the digest, you may need to inspect the Superset frontend or API responses for this value.
For more details on how this is implemented in the frontend, you can refer to the [useDownloadScreenshot hook](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/hooks/useDownloadScreenshot.ts), which uses a similar API endpoint to fetch and download dashboard screenshots as images or PDFs.
Let me know if you need more details on obtaining the digest or automating this process!
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=ec253eb5-d022-4cd1-9427-6753be50215b) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/33589#discussioncomment-13282587
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Download dashboard as an image using API [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Download dashboard as an image using API
<!-- Answer -->
Yes, it is possible to download a dashboard as an image using the API in Apache Superset.
### Steps to Download a Dashboard as an Image via API
1. **Identify the Dashboard ID and Digest**
- You need the dashboard's primary key (`pk`) and a unique hex digest (`digest`) for the dashboard. The digest is used to identify the specific state of the dashboard.
2. **API Endpoint**
- Use the following endpoint to request the dashboard image:
```
GET /api/v1/dashboard/{pk}/thumbnail/{digest}/
```
Replace `{pk}` with your dashboard's ID and `{digest}` with the appropriate digest value.
3. **Expected Responses**
- **HTTP 200**: Returns the dashboard thumbnail image in binary format (image).
- **HTTP 202**: The thumbnail does not exist in the cache; the server will start generating it asynchronously. You may need to retry after a short wait.
[See API details](https://github.com/apache/superset/blob/master/docs/static/resources/openapi.json)
4. **Authentication**
- Make sure your API request is authenticated (e.g., using a session cookie or Bearer token, depending on your Superset setup).
5. **Example Request (using `curl`):**
```bash
curl -X GET \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
"https://<your-superset-domain>/api/v1/dashboard/<pk>/thumbnail/<digest>/"
--output dashboard.png
```
6. **Handling Asynchronous Generation**
- If you receive a 202 response, wait a few seconds and retry the request until you receive the image (HTTP 200).
### Notes
- The thumbnail image represents the dashboard's current state as rendered in the UI.
- The digest parameter ensures you get the correct version of the dashboard. If you are unsure how to obtain the digest, you may need to inspect the Superset frontend or API responses for this value.
For more details on how this is implemented in the frontend, you can refer to the [useDownloadScreenshot hook](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/hooks/useDownloadScreenshot.ts), which uses a similar API endpoint to fetch and download dashboard screenshots as images or PDFs.
Let me know if you need more details on obtaining the digest or automating this process!
<!-- Dosu Comment Footer -->
*To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ec253eb5-d022-4cd1-9427-6753be50215b?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/33589)
GitHub link: https://github.com/apache/superset/discussions/33589#discussioncomment-13282587
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org