2020-04-23 00:41:38 +02:00

64 lines
1.7 KiB
Plaintext

# Data Structures
## Login (object)
+ username: babar (string)
+ password: tortue (string)
## Token (object)
+ token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c (string)
## InvalidCredentials (object)
+ description: Invalid credentials (string),
+ error: Bad Request (string),
+ status_code: 401 (number)
# Group Accounts
## Create an account [/user]
### Register a new user [POST]
+ Request (application/json)
+ Attributes (object)
+ username: babar (string)
+ email: `michel@seed-it.eu` (string)
+ password: tortue (string)
+ Response 200 (application/json)
+ Attributes (object)
+ message: Created (string)
+ Response 409 (application/json)
+ Attributes (object)
+ message: User already exists (string)
## Authenticate user [/user/login]
Authenticate one user to access protected routing.
### Authenticate a user [POST]
+ Request (application/json)
+ Attributes (Login)
+ Response 200 (application/json)
+ Attributes (Token)
+ Response 401 (application/json)
+ Attributes (InvalidCredentials)
## Get User Info [/user/me]
Receive the username and email from the currently logged in user
### Get User Info [GET]
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
+ Response 200 (application/json)
+ Attributes
+ user: (object)
+ username: Jean (string)
+ email: abc@def.ghi