"database": "value must be an integer."

Hi,

I am trying to retrieve all data in a small table through Metabase API,
but got an error of {“errors”:{“database”:“value must be an integer.”}}.
The data JSON shown below was taken from browser URI (BASE64 decoded).
And, … I think “database” parameter has an integer value of 2.

Could someone suggest clues, please?
Thanks in advance.

moto.

session_id=‘d7f61a84-46cb-4ef9-a085-a3f86798b1ab’
curl
-s
-X POST
-H “Content-Type: application/json”
-H “X-Metabase-Session: ${session_id}”
-d '{“dataset_query”:
{“database”:2,
“query”:{“source-table”:314},
“type”:“query”},
“display”:“table”,
“visualization_settings”:{}}

https://my.metabase.node/metabase/api/dataset
{“errors”:{“database”:“value must be an integer.”}}

ps. metabase 0.36.6 is running on my.metabase.node.

[Self answer]
It seems ok if I strip the JSON and use the following as -d option value.
Thanks.

Hi @moto
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.
For reference: https://www.metabase.com/blog/metabase-api/index.html