Programmatic way to add Users?

Can JSON field values corresponding to Metabase User API fields be made to add new users programmatically?
ref -- metabase/src/metabase/api/user.clj at master · metabase/metabase · GitHub

Example scenario:
An automated JSON payload containing a single line of information such as first_name, last_name, email, password, group_id, etc. is received by a url endpoint on one's server from Stripe, Chargebee, or some other subscription service. ref -- Use incoming webhooks to get real-time updates | Stripe Documentation

How can that information be unpacked and applied to programmatically add a new user?

The intention is to provide metrics to users via Metabase on a paid subscription basis with two or more tiers of content access without having to manually associate new users to a group. Any suggestions, example applications, pointing in right direction would be appreciated!

Some time ago a thread titled :

didn't seem to generate followup but has since been viewed nearly 800 times so this thread is being categorized under FAQ :slight_smile:

In the API documentation:

Then more bits about adding users. Take a look at:

Thank you, did wonder about additional documentation on the api/user.clj… Feeding JSON field values into and or invoking the same is another matter. To the initiated this must be quite trivial. To a neophyte like myself, however, what that bridge between the “gift-wrapped” JSON values and the api/user is supposed to look like and how it is made to function is still vague. Me thinks I’m in for a bit of learning curve!:sweat_smile:

Howdy neophyte! :smiley: (we all start as such)

I think it’s mostly because 2nd post of Any API or programmatic way to add users - #2 by vidyanand actually is a “self answer” to the question over there with the curl command line example of using Metabase’s REST API. Then there was not much need for additional answers in that thread.

Find additional pointers in this WIKI topic in here:

I hope that’s the gift wrapping magic you’re looking for?

edit: though right now the GitHub API page link over there appears broken to me — hopefully just an interim glitch :worried: edit2: I found and fixed the problem with the link to Using the REST API · metabase/metabase Wiki · GitHub in the topic above

Thank you so much! Now this looks like the kind of nitty-gritty required for the job!:star_struck:

1 Like