87 lines
1.8 KiB
Plaintext
87 lines
1.8 KiB
Plaintext
# Data Structures
|
|
|
|
## Login (object)
|
|
+ username: babar (string)
|
|
+ password: tortue (string)
|
|
|
|
|
|
## InvalidCredentials (object)
|
|
+ description: Invalid credentials (string),
|
|
+ error: Bad Request (string),
|
|
+ status_code: 401 (number)
|
|
|
|
# Group Accounts
|
|
|
|
## Account [/user]
|
|
|
|
### Register a new user [POST]
|
|
|
|
+ Request (application/json)
|
|
+ Attributes (object)
|
|
+ username: babar (string)
|
|
+ password: tortue (string)
|
|
|
|
+ Response 200 (application/json)
|
|
+ Attributes (object)
|
|
+ message: Created (string)
|
|
|
|
+ Response 409 (application/json)
|
|
+ Attributes (object)
|
|
+ message: User already exists (string)
|
|
|
|
### Delete a user [DELETE]
|
|
|
|
+ Request
|
|
+ Headers
|
|
Authorization: Bearer <token>
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
|
|
## Authentication [/user/login]
|
|
Authenticate one user to access protected routing.
|
|
|
|
### Authenticate a user [POST]
|
|
|
|
+ Request (application/json)
|
|
+ Attributes (Login)
|
|
|
|
+ Response 200 (application/json)
|
|
+ Attributes
|
|
+ token: <token>
|
|
+ refreshToken: `<refresh-token>`
|
|
|
|
+ Response 401 (application/json)
|
|
+ Attributes (InvalidCredentials)
|
|
|
|
## Token refresh [/user/refresh_token]
|
|
|
|
### Refresh JWT token [POST]
|
|
|
|
+ Request (application/json)
|
|
+ Attributes
|
|
+ refreshToken: `<refresh-token>`
|
|
|
|
+ Response 200 (application/json)
|
|
+ Attributes
|
|
+ token: <token>
|
|
+ refreshToken: `<refresh-token>`
|
|
|
|
+ Response 401 (application/json)
|
|
+ Attributes (InvalidCredentials)
|
|
|
|
## 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 <token>
|
|
|
|
|
|
+ Response 200 (application/json)
|
|
+ Attributes
|
|
+ user: (object)
|
|
+ username: babar (string)
|