User
Endpoints for managing users.
'/users'
POST
async signUp(
@requestBody({
content: {
'application/json': {
schema: getModelSchemaRef(User, {
title: 'NewUser',
}),
},
},
})
newUser: User,
): Promise<User>Auth: No
Create a new user and send verification email.
GET
async find(@param.filter(User) filter?: Filter<User>): Promise<User[]>Auth: Yes RBAC: Admin
Get all users.
'/users/{id}'
GET
async findById(
@param.path.string('id') id: string,
@param.filter(User, { exclude: 'where' }) filter?: FilterExcludingWhere<User>,
): Promise<User>Auth: Yes RBAC: Admin, User (owner)
Get a specific user by ID.
DEL
async deleteById(@param.path.string('id') id: string): Promise<void>Auth: Yes RBAC: Admin, User (owner)
Delete a specific user by ID.
PATCH
async updateById(
@param.path.string('id') id: string,
@requestBody({
content: {
'application/json': {
schema: getModelSchemaRef(User, { partial: true }),
},
},
})
userBase: User,
): Promise<void>Auth: Yes RBAC: Admin, User (owner)
Update a specific user by ID.
'/users/login'
POST
async login(
@requestBody(CredentialsRequestBody) credentials: Credentials,
): Promise<{
token: string;
username: string;
userId: string;
userType: string;
}>Auth: No
Try to authenticate as a user.
'/whoAmI'
GET
async whoAmI(
@inject(SecurityBindings.USER)
currentUserProfile: UserProfile,
): Promise<string>Auth: Yes
Check user profile for debugging purposes.
'/users/logout'
POST
async logout(
@requestBody({
content: {
'application/json': {
schema: getModelSchemaRef(User, {
title: 'NewUser',
exclude: ['id'],
}),
},
},
})
userBase: Omit<User, 'id'>,
): Promise<void>Auth: Yes
Unauthenticate and log out of user account.
'/users/api-token'
GET
async getApiToken(): Promise<object>Auth: Yes
Get API tokens.
'/users/verify-email'
POST
async resendVerifyEmail(
@requestBody({
content: {
'application/json': {
schema: {
properties: {
email: {
type: 'string',
},
},
required: ['email'],
},
},
},
})
email: {
email: string;
},
): Promise<void>Auth: No
Request a new verification email to be send for the given user.
'/users/verify'
GET
async verify(
@param.query.string('userId') userId: string,
@param.query.string('token') verificationToken: string,
@inject(RestBindings.Http.RESPONSE) response: Response,
): Promise<User>Auth: No
Verify a user's email using the token from the verification email.
'/users/forgot-password'
POST
async reset(
@requestBody({
content: {
'application/json': {
type: 'object',
schema: {
properties: {
email: { type: 'string', format: 'email' },
},
},
},
},
})
data: {
email: string;
},
): Promise<void>Auth: No
Request a password reset email to be sent to the user's email.
'/users/change-password'
POST
async changePassword(
@requestBody({
content: {
'application/json': {
type: 'object',
schema: {
properties: {
oldPassword: { type: 'string' },
newPassword: { type: 'string' },
},
},
},
},
})
data: { oldPassword: string; newPassword: string },
@inject(SecurityBindings.USER)
userProfile: UserProfile,
): Promise<void>Auth: Yes RBAC: Admin, User (owner)
Change a given user's password.
'/users/reset-password'
POST
async resetPassword(
@requestBody({
content: {
'application/json': {
type: 'object',
schema: {
properties: {
newPassword: { type: 'string' },
accessToken: { type: 'string' },
},
},
},
},
})
data: {
newPassword: string;
accessToken: string;
},
): Promise<void>Auth: No
Reset a given user's password using the reset token from the reset password email.
'/users/creds-taken'
POST
async checkCredsTaken(
@requestBody() body: { username: string; email: string },
): Promise<{ usernameTaken: boolean; emailTaken: boolean }>Auth: No
Check if a set of user credentials are taken.
Last updated