Mian Awais
Mian Awais

Reputation: 1

How to Retrieve Superset Dashboard Thumbnail Image in Angular Application Using API?

Hello Stack Overflow community,

I am working on integrating Superset with my Angular application, and I'm facing a challenge while trying to fetch the thumbnail image of a Superset dashboard. Currently, I'm using the following API endpoint:

/api/v1/dashboard/{pk}/thumbnail/{digest}/

I provide the necessary parameters (pk, digest), and upon setting the "force" parameter to false, I receive the following response: {"message":"OK Async"}.

Here is a snippet of my current Angular code:

// Angular service code
this.thumbnailService.getThumbnail(pk, digest).subscribe(
  (response) => {
    // Currently, I'm getting {"message":"OK Async"} in the response.
    // I want to get the actual image instead.
    console.log('Response:', response);
  },
  (error) => {
    console.error('Error fetching thumbnail:', error);
  }
);

Thank you in advance for any assistance or insights you can provide!

However, my goal is to directly obtain the thumbnail image in the response instead of the asynchronous message. I've reviewed the Superset documentation, but I couldn't find a clear solution for this. If anyone has experience with fetching Superset dashboard thumbnail images in an Angular application and can provide guidance on how to obtain the image directly, I would greatly appreciate your help.

Upvotes: 0

Views: 660

Answers (1)

ianianianian
ianianianian

Reputation: 50

You are logging the whole response, which probably contains the header and the image is likely one level down, assigned to a variable eg. response.theImage.

Check the data type of the response and look at the available properties of that type.

Upvotes: 1

Related Questions