Common commands for metabase

  • Get the administrator session

Many operations are based on session

curl -X POST -H "Content-Type: application/json" -d '{"username": "[email protected]", "password": "root"}' http://127.0.0.1:3000/api/session

{
    
    "id":"c9ad042a-9481-4547-bd77-e83321e20f26"}% 
  • Create an account

Fill in the id obtained above into X-Metabase-Session. The grouping can be left blank. If the group_ids parameter is filled in, it must contain 1 all group. It is convenient to create users in batches and group by commands.

curl -X POST -H "Content-Type: application/json" -H "X-Metabase-Session: c9ad042a-9481-4547-bd77-e83321e20f26" -d '{"first_name": "wu", "last_name": "core", "email": "[email protected]", "password": "test1", "group_ids":[1,20]}' http://127.0.0.1:3000/api/user
  • Reset user password

Find the user id in the database, my name is 96, and password fill in the new password.

curl  -X PUT -H "Content-Type: application/json" -H "X-Metabase-Session: c9ad042a-9481-4547-bd77-e83321e20f26" -d '{"password" :"test1234"}'  http://127.0.0.1:3000/api/user/96/password 
  • View user information
curl  -H "X-Metabase-Session: 3a133416-b27e-4503-b8a6-74d51bd89742"  http://127.0.0.1:3000/api/user/96
  • View panel, problem data
curl -X POST -H "X-Metabase-Session: 3a133416-b27e-4503-b8a6-74d51bd89742" http://127.0.0.1:3000/api/card/597/query

{
    
    "data":{
    
    "rows":[
["2020-09-10T00:00:00+08:00",6.355237937855E10],
["2020-09-09T00:00:00+08:00",7.4175531087601E10],
["2020-09-08T00:00:00+08:00",8.4376768223309E10],
["2020-09-07T00:00:00+08:00",8.4343592824870998E10],
["2020-09-06T00:00:00+08:00",8.3672440357048998E10],
["2020-09-05T00:00:00+08:00",8.3682336807729E10],
["2020-09-04T00:00:00+08:00",8.3643838965455E10]
],

Guess you like

Origin blog.csdn.net/yyoc97/article/details/108470454