-
Notifications
You must be signed in to change notification settings - Fork 12
Account endpoints
tkaixiang edited this page Aug 21, 2021
·
3 revisions
Creates a new account
{
"username": "NEW_USERNAME",
"password": "NEW_PASSWORD",
"email": "NEW EMAIL"
}
{
"success": true
}
Error | Definition |
---|---|
username-taken |
The username submitted is already in use |
email-taken |
The email submitted is already in use |
email-formatting |
The email submitted was malformed |
Deletes multiple accounts (or own account)
Authenticated // Permissions: 2 for deleting other accounts
Admin Input:
{
"users": ["username1 to delete", "user2"...]
}
If deleting own account:
{
"password": "user_password"
}
{
"success": true
}
- If
users
is empty, the own user will be deleted -
users
can only be defined by a user with permissions level 2 - If
users
is defined, the own user's account cannot be deleted as a precaution - This endpoint is very slow
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to delete another user |
not_found |
None of the users supplied exist |
wrong_password |
The password the user entered to delete their own account was incorrect |
Checks if a username has been taken
{
"username": "USERNAME_TO_CHECK"
}
{
"success": true,
"taken": "bool"
}
- Do not ping this endpoint on every keystroke (check after user stops typing for a certain delay)
No special errors
Checks if an email address has been taken
{
"email": "EMAIL_ADDRESS_TO_CHECK"
}
{
"success": true,
"taken": "bool"
}
- Do not ping this endpoint on every keystroke (check after user stops typing for a certain delay)
No special errors
Login endpoint
{
"username": "USERNAME",
"password": "PASSWORD"
}
{
"success": true,
"permissions": 0-2 (int from 0-2),
"token": "TOKEN_STRING"
}
- Do not process the
token
. Store it directly as its format may change without notice.
Error | Definition |
---|---|
wrong-details |
The wrong username/password was entered |
Returns the updated permissions level of the logged-in user
Authenticated
No input required
{
"success": true,
"type": 0-2(int from 0-2)
}
No special errors
Change the password of the user
Authenticated
{
"password": "OLD_PASSWORD",
"new_password": "NEW_PASSWORD"
}
{
"success": true
}
Error | Definition |
---|---|
not-found |
The username specified was not found |
empty-password |
The new_password field is empty |
wrong-password |
The password field does not match the old password |
List all accounts
Authenticated // Permissions: 2
None
{
"success": true,
"list": [
{
"username": "USERNAME_OF_USER",
"email": "USER_EMAIL_ADDRESS",
"type": "int from 0-2 (permissions level)",
"score": "int"
},
{
"username": "USERNAME_OF_USER",
"email": "USER_EMAIL_ADDRESS",
"type": "int from 0-2 (permissions level)",
"score": "int"
}
]
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to list all users |
Changes the password of an account Authenticated // Permissions: 2
{
"username": "USERNAME_OF_ACCOUNT_TO_CHANGE",
"password": "new_password"
}
{
"success": true
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to change another user's permission |
empty-password |
The password field is empty |
Changes the permissions of an account
Authenticated // Permissions: 2
{
"username": "USERNAME_OF_ACCOUNT_TO_CHANGE",
"type": "int from 0-2 (new permissions level)"
}
{
"success": true
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to change another user's permission |
out-of-range |
type is not between 0 to 2 |
Retrieves the states of the users settings in the admin panel Authenticated // Permissions: 2
None
{
"success": true,
"states": []
}
Error | Definition |
---|---|
permissions |
The logged-in user does not have sufficient permissions to change another user's permission |
out-of-range |
type is not between 0 to 2 |