CURL - PHP code for Metebase question

Hello,

I am new to this forum, seeking help to understand the work around for my query. One of our Vendor has moved from php database to metabasen and all the sales are now displayed on screen via metabase query with public question created by them. Its a link basically which throws the output on screen with .csv, .json and .xlsx optoin to download. We here have a php designed with throws the output with additional ino like area, sales agent name etc.

Problem is here -

We have an internal portal which has lot of other options. One option is daily sales report in which earlier data was fetched using crul code and without any manual intervention, our database was fetching new sales entries in database and our portal get updated accordingly. Now when our vendor has shifted to metabase, this curl code is failing to get the records from there.

Can anyone please help me with the curl code as Vendor wont share password or field names of his metabase data. Nor he is willing to share any API or create a link and share it with us to implement in our php program...

Basically, I want the manual donwload portion to get replaced with curl code in php coding so that our portal can get updated automataclly.

Hi @galajits
Everything you can do in the Metabase interface can also be done with cURL through the API.
https://www.metabase.com/learn/developing-applications/advanced-metabase/metabase-api.html
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.
And most browsers allows you to right-click the request and "copy as cURL"

I won't be able to help further, since you're not providing enough information, but I can only give one recommendation: Leave the vendor.

I requested Vendor to get me the API to integrate in my PHP portal, but they are not giving that. Cannot leave Vendor too as its a part of our client contract. That is where the hook is. Cant we do anything with question http://analytics.xxx.org:3000/public/question/340djslxd-xx33ccklfd33-4395dkdmllskvms023 in curl to save the .csv file automatically on server

@galajits Every public question can be downloaded as CSV/XLSX/JSON directly by adding extension to the end like this:
/public/question/340djslxd-xx33ccklfd33-4395dkdmllskvms023.csv

Hi

I tried in multiple ways to download, but with no luck.

Can anyone help me with the php code which will download the csv file from public/question link

@galajits

  1. Post "Diagnostic Info" from Admin > Troubleshooting.
  2. Post your PHP code. And post any errors that you encounter, since it's impossible to know how/what you have been trying.
  3. Perhaps your code is not handling the redirect, then try downloading directly from the API:
    /api/public/card/340djslxd-xx33ccklfd33-4395dkdmllskvms023/query/csv