How to get the image extension .JPG

Is it possible to get the exact filename and extension URL?

I need the filename to use in a web service, but it needs the tradicional image URL “https://…chart.jpg” or “https://…chart.png” to work properly.

Hi @andreantivilo,

You can append the text &f=.png to the chart URL to give it a proper filename ending.

For example:

https://quickchart.io/chart?c={type:'bar',data:{labels:[2012,2013,2014,2015, 2016],datasets:[{label:'Users',data:[120,60,50,180,120]}]}}&f=.png

If you are using a “short URL” or Chart Maker URL, you can do the following:

https://quickchart.io/chart/render/9a560ba4-ab71-4d1e-89ea-ce4741e9d232?f=.png

I need to automatically download this file. The system needs to receive the whole URL with the file.jpg

In the meantime, I figured it out using Make to call the chart API, then I used Google Cloud Storage to upload the file (created with the chart data response) and then I can send a WhatsApp message with the complete chart file url.

Hi @andreantivilo,

Good news - we’ve recently added support for jpg to you can use that instead of png if desired. We’ve also added support for the format or f parameter on /chart/render routes. This parameter controls the output type.

The content-type of a /chart/render route is an image file. In this case, the image URL is simply https://quickchart.io/chart/render/9a560ba4-ab71-4d1e-89ea-ce4741e9d232?f=.jpg. When you load it you will receive a JPG.