Programmatic way to add Users?


#1

Can JSON field values corresponding to Metabase User API fields be made to add new users programmatically?
ref – https://github.com/metabase/metabase/blob/master/src/metabase/api/user.clj

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 – https://stripe.com/docs/webhooks

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!

ps
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:


#2

In the API documentation:
image

Then more bits about adding users. Take a look at: https://github.com/metabase/metabase/blob/master/docs/api-documentation.md


#3

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:


#4

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 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 https://github.com/metabase/metabase/wiki/Using-the-REST-API in the topic above


#5

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