Imported Google Group message.
Sender:Martin Buhr
.
Date:Monday, 4 January 2016 23:14:49 UTC.
Hi Russ,
[I’ve copied this message thread back to the user group so it’s available for the whole community.]
You can get a list of orgs, that endpoint supports the GET method.
If you create a super user, that user can list all users (as its unbounded). The create call returns the users API token.
If you create a random super user, use it’s token for the bootstrap tasks needed, then delete it, then you have indempotence and can still guarantee a single admin user so long as you clean up after yourself.
Take a look at our setup script for docker instances, it would need extending, but you can do something similar to check for an existing admin user: https://github.com/lonelycode/tyk_quickstart/blob/master/setup.sh
It’s not ideal and we’re constantly adding to the admin API (it used to only allow creates for orgs and users to facilitate bootstrapping), so this is on the roadmap.
Cheers,
Martin
From: Russ Egan [email protected]
Sent: Monday, January 4, 2016 22:52
Subject: Re: tykdash 0.9.7.0: /admin routes in rest api are all not found
To: Martin Buhr [email protected]
I see. I guess the same is true for the organizations. This makes the api fairly difficult to use. You need the user uid to get or update an existing user, and the create call doesn’t return that. And you can call create over and over again with the same body, and it will create duplicate users instead of returning an error. I’m trying to write an idempotent deployment script that checks whether an admin user is created yet and creates it if necessary, but it doesn’t look like it possible to implement this with the current API.
On Mon, Jan 4, 2016 at 2:41 PM -0800, “Russ Egan” [email protected] wrote:
curl -X “GET” " http://192.168.157.151:3000/admin/users/"
-H "admin-auth: 12345”
is also not found (that ip is my docker-machine). But this works:
curl -X “GET” " http://192.168.157.151:3000/admin/system/reload"
-H “admin-auth: 12345”
On Mon, Jan 4, 2016 at 5:38 PM Martin Buhr < [email protected]> wrote:
Ah, just checked out the code again - the endpoints need a trailing slash on the admin APIs, our muxer is quite strict.
Cheers,
Martin