Skip to content
luishens01 edited this page Jan 6, 2019 · 2 revisions

This wiki page is part of the usage documentation of the tng-gtk-usr repository.

Context

These are the operations for the Users of the tng-gtk-usr

tng-gtk-usr/login

  • POST

Try to login:

    {
        "username":"tango",
        "password":"t4ng0"
    }

This will give as response the Authorization Token among other info

{ 
"token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InBhY28iLCJlbWFpbCI6InBhY29AcGFjbyIsImVuZHBvaW50cyI6W3siZW5kcG9pbnQiOiJwYWNrYWdlcyIsInZlcmJzIjoiZ2V0LHBvc3QscHV0In0seyJlbmRwb2ludCI6InNlcnZpY2VzIiwidmVyYnMiOiJnZXQscG9zdCJ9LHsiZW5kcG9pbnQiOiJ0aGluZ3NzcyIsInZlcmJzIjoiZ2V0LHBvc3QscHV0In1dLCJsb2dpbl90aW1lIjoiMjAxOC0xMi0xNiAxMDo1NjoyMCArMDEwMCIsImV4cGlyYXRpb25fdGltZSI6IjIwMTgtMTItMTYgMTE6NTY6MjAgKzAxMDAifQ.54GlbDHuwHLefJamry3WBaZwbkSRwMzVZF3pxK42nQQ", 
"endpoints": [ 
				{ "endpoint": "packages", "verbs": "get,post,put" }, 
				{ "endpoint": "services", "verbs": "get,post" }, 
				{ "endpoint": "thingsss", "verbs": "get,post,put" } 
			] 
}

tng-gtk-usr/users

  • GET

This gives the list of all users

  • POST

Register a new user. The account's status is setted to 'active' by default. It can be changed later with the update.

    {
        "username":"tango",
        "name":"tango",
        "password":"t4ng0",
        "email":"[email protected]",
        "role":"admin"
    }
  • DELETE

Clean the DB deleting all users

tng-gtk-usr/users/:username

  • GET

This gives the info of this user

tng-gtk-usr/users/:username/endpoints

  • GET

This gives the list of endpoints of this user's role

tng-gtk-usr/users/:username/update

  • POST

Update the info about this user. Here you can change the account status (is setted to 'active' when registering a new user)

    {
        "status":"cancelled",
        "password":"tango",
        "role":"customer",
        "email":"[email protected]"
    }