-
Notifications
You must be signed in to change notification settings - Fork 1
User
Endpoint for handling users and roles.
| Command | Method | Route | Description |
|---|---|---|---|
| CurrentUser | GET | /{culture}/api/User | Fetches a current logged user. |
Call to this API method will retrive a currently logged in user data. Response data will be in the following format:
{
"username": <string>,
"token": <string>,
"image": <string>
}
Example response for en-US/api/User:
{
"username": "bob",
"token": "eyJhbTciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiJhZG1pbmlzdHJhdG9yIiwicm9sZSI6IkFkbWluaXN0cmF0b3IiLCJuYmYiOjE2MTA3MTY0ODUsImV4cCI6MTYxMTMyMTI4NSwjaWF0IjoxNjEwNzE2NDg1fQ.JVc1KRNLiVkwJ2jCf03TrFUt0MUTkerXiyQu6qGU61hHbTcIuwErbA9aPkRLeLgLgu_TX7j6zW-yCbRDIWHwFA",
"image": "https://res.cloudinary.com/socialknow/image/upload/v9808200349/c2y3qalp4ugmwfxdzmxo.jpg"
}| Command | Method | Route | Description |
|---|---|---|---|
| Delete | DELETE | /{culture}/api/User | Delete selected user by username. |
Call to this API method will delete user selected by username provided in query string.
Example request to delete user with username "Bob":
en-US/api/User?username=Bob
The response to this call will return status code 204 if an user was deleted correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| Register | POST | /{culture}/api/User/register | Register a new user. |
Call to this API method will result in the creation of a new user with provided user register credentials. The format of the arguments in the request body is JSON.
Request body will be in the following format:
{
"username": <string>,
"email": <string>,
"password": <string>
}
The response to this call will return data of newly created user:
{
"username": <string>,
"token": <string>,
"image": <string>
}
| Command | Method | Route | Description |
|---|---|---|---|
| Login | POST | /{culture}/api/User/login | Logs in an existing user. |
Call to this API method will result in the logging in an user if provided login credentials are correct. The format of the arguments in the request body is JSON.
Request body will be in the following format:
{
"username": <string>,
"password": <string>
}
The response to this call will return data of logged in user:
{
"username": <string>,
"token": <string>,
"image": <string>
}
| Command | Method | Route | Description |
|---|---|---|---|
| Logout | POST | /{culture}/api/User/logout | Logs out a current user. |
Call to this API method will result in the logging out a current user and saving user's token to blacklist till the end of token's lifetime.
The response to this call will return no content anwser.
| Command | Method | Route | Description |
|---|---|---|---|
| AdRoleToUser | POST | /{culture}/api/User/role | Adds new role to selected user. |
Call to this API method will result in assigning role to the selected user. The format of the arguments in the request body is JSON.
Request body will be in the following format:
{
"username": <string>,
"role": <string>
}
The response to this call will return status code 204 if a role was assigned correctly.
| Command | Method | Route | Description |
|---|---|---|---|
| RemoveRoleFromUser | DELETE | /{culture}/api/User/role | Deletes provided role from selected user. |
Call to this API method will result in deleting role from selected user. The format of the arguments in the request body is JSON.
Request body will be in the following format:
{
"username": <string>,
"role": <string>
}
The response to this call will return status code 204 if a role was deleted from user correctly.