Sending Data to metabase DB via API

Hello, I’d like to POST data into the metabase postgresql DB via api. When a customer makes a transaction, i’d like to send the data. I have metabase hosted on aws elastic beanstalk at the moment. Is this something that is currently do-able and I am just missing it in the API docs?

Any response would be greatly appreciated!

Dan

Hi @danmitzer

Are you’re talking about the backend database containing metadata? By default running H2, but can be changed to Postgres or MariaDB/MySQL.
If yes, then you can use API:
https://github.com/metabase/metabase/wiki/Using-the-REST-API
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md

If you’re talking about the datasource - meaning the databases containing your data, then no, you would need to communicate directly with them.

1 Like

@flamber I am talking about the database containing metadata for metabase. It is currently postgres. So from what I gather, it is possible. But which API endpoint would I call is what I’m having trouble finding. I will be sending it as a json of course. Do you happen to know the endpoint to which I can post this data?

But I don’t understand what you’re trying to do. I don’t understand “customer makes a transaction”

@flamber Sorry, let me make myself more clear. When a customer makes a transaction on our sales site, we would like to send a HTTP POST request containing customer information in the form of a JSON to the postgres DB for metabase’s backend. Both metabase and it’s DB are hosted on aws. That is all. So my question, to clarify, is which api endpoint could I call to perform such a task?

It seems perfectly doable, but I’m still a little uncertain.

Thanks

Okay, but I think you’re misunderstanding metadata and datasource.
Metadata is the database storing all the configuration and indexes of Metabase.
Datasource is your database, which actually contains your information. This is the database you configure in Metabase’s Admin > Databases.

@flamber ah, got it. See, what I had done was create another DB on the posgres server for metabase’s configuration in order to store this data. I suppose the only way to do what I’m asking is to have our backend directly connect to the DB i’ve created on this server and insert the data that way.

Am I correct in saying this?

@danmitzer
Don’t touch the Metabase database. You’ll like end up corrupting something.
What you want is to talk to your app database and insert/update/delete whatever information you want.