Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post API For creating new user at initial setup showing #7512

Closed
amanmalkar opened this issue May 1, 2018 · 7 comments
Closed

Post API For creating new user at initial setup showing #7512

amanmalkar opened this issue May 1, 2018 · 7 comments
Labels
Misc/API Type:Question Please use the forum: https://discourse.metabase.com/

Comments

@amanmalkar
Copy link

amanmalkar commented May 1, 2018

curl -X POST -H "Content-Type: application/json" -d '{"email": "amanmalkar@gmail.com", "first_name": "aman", "site_name": "MetabasTest", "password": "xyz7030", "token": "56dd2a37-8383-4d07-b634-10ce7afb4835", "last_name": "malkar"}' http://localhost:3000/api/setup/

{"errors":{"site_name":"value must be a non-blank string."}}

@camsaul
Copy link
Member

camsaul commented May 1, 2018

Hi @amanmalkar, for that endpoint you need to use nested maps

  • token can go under top level
  • under database: name, engine, details, is_full_sync, is_on_demand, schedules
  • under user: first_name, last_name, email, password
  • under prefs: allow_tracking, site_name

@camsaul camsaul added Type:Question Please use the forum: https://discourse.metabase.com/ Misc/API labels May 1, 2018
@amanmalkar
Copy link
Author

amanmalkar commented May 2, 2018

@camsaul I did it. Thanks for the help.

For anyone struggling with the REST API Initial setup:

If you're not integrating db at launch you can do:

curl -X POST -H "Content-Type: application/json" -d '{ "token": "56dd2a37-8383-4d07-b634-10ce7afb4835", "user": {"first_name": "xyz", "last_name": "abc", "email": "xyabzc@gmail.com", "password": "xzy7030"},"prefs": {"allow_tracking": true, "site_name": "yyzz"}}' http://localhost:3000/api/setup

@manugarri
Copy link

@amanmalkar thanks! how do you get the token at initial setup?

@amanmalkar
Copy link
Author

@manugarri Hi! This should help

token=$(curl -s -X GET -H "Content-Type: application/json" http://localhost:3000/api/session/properties | python2.7 -c 'import sys, json; print json.load(sys.stdin)["setup_token"]' | tail -1)

replace with your py version. Let me know :)

@manugarri
Copy link

awesome, thanks!

@tmck-code
Copy link

@camsaul I did it. Thanks for the help.

For anyone struggling with the REST API Initial setup:

If you're not integrating db at launch you can do:

curl -X POST -H "Content-Type: application/json" -d '{ "token": "56dd2a37-8383-4d07-b634-10ce7afb4835", "user": {"first_name": "xyz", "last_name": "abc", "email": "xyabzc@gmail.com", "password": "xzy7030"},"prefs": {"allow_tracking": true, "site_name": "yyzz"}}' http://localhost:3000/api/setup

You are a stone-cold legend

@flamber
Copy link
Contributor

flamber commented May 30, 2020

Closing in favor of #11440 and #9033

@flamber flamber closed this as completed May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Misc/API Type:Question Please use the forum: https://discourse.metabase.com/
Projects
None yet
Development

No branches or pull requests

5 participants