Testaustime API gives 5 different routes:
Basic path: https://api.testaustime.fi
Limits:
- Usual Ratelimit: 10 req/m.
Contains various user authorization operations
Endpoint | Method | Description |
---|---|---|
/auth/register | POST | Creating a new user and returns the user auth token, friend code and registration time |
/auth/login | POST | Loging user to system and returns the user auth token and friend code |
/auth/securedaccess | POST | Generating secured access token |
/auth/changeusername | POST | Changing user username |
/auth/changepassword | POST | Changing user password |
/auth/regenerate | POST | Regenerating user auth token |
Creating a new user and returns the user auth token, friend code and registration time. Ratelimit: 1 req/24h
Header params
Name | Value |
---|---|
Content-Type | application/json |
Body params
Param | Type | Required | Description |
---|---|---|---|
username | string | Yes | Usename has to be between 2 and 32 characters long |
password | string | Yes | Password has to be between 8 and 128 characters long |
Sample request
curl --request POST https://api.testaustime.fi/auth/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "username",
"password": "password"
}
Sample response
{
"auth_token": "<token>",
"username": "username",
"friend_code": "friend_code",
"registration_time": "YYYY-MM-DDTHH:MM:SS.sssssssssZ"
}
Response definitions
Response Item | Type | Description |
---|---|---|
auth_token | string | Authentication token for identifying the user |
username | string | Username |
friend_code | string | With this code other users can add user to the friend list |
registration_time | string | Time of registration in ISO 8601 format |
Logins to a users account and returning the authentication token
Header params
Name | Value |
---|---|
Content-Type | application/json |
Body params
Param | Type | Required | Description |
---|---|---|---|
username | string | Yes | Usename has to be between 2 and 32 characters long |
password | string | Yes | Password has to be between 8 and 128 characters long |
Sample request
curl --request POST 'https://api.testaustime.fi/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "username",
"password": "password"
}'
Sample response
{
"id": 0,
"auth_token": "<token>",
"friend_code": "friend_code",
"username": "username",
"registration_time": "YYYY-MM-DDTHH:MM:SS.ssssssZ"
}
Response definitions
Response Item | Type | Description |
---|---|---|
id | int | User id |
auth_token | string | Authentication token for identifying the user |
username | string | Username |
friend_code | string | With this code other users can add user to the friend list |
registration_time | string | Time of registration in ISO 8601 format |
Generates new secured access token, each token is valid for 1 hour. Used for confirming user identity when doing critical changes.
Header params
Name | Value |
---|---|
Content-Type | application/json |
Body params
Param | Type | Required | Description |
---|---|---|---|
username | string | Yes | Usename has to be between 2 and 32 characters long |
password | string | Yes | Password has to be between 8 and 128 characters long |
Sample request
curl --request POST 'https://api.testaustime.fi/auth/securedaccess' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "username",
"password": "password"
}'
Sample response
{
"token": "<token>"
}
Response definitions
Response Item | Type | Description |
---|---|---|
token | string | Secured access token |
Changes username, requires secured access token
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <sec_token> |
Body params:
Param | Type | Required | Description |
---|---|---|---|
new | string | Yes | New username. Usename has to be between 2 and 32 characters long |
Sample request
curl --request POST 'https://api.testaustime.fi/auth/changeusername' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <sec_token> '{
"new": "new_username"
}'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
"new" has <2 or >32 symbols | 400 Bad Request | {"error" : "Username is not between 2 and 32 chars"} |
"new" is using existing username | 403 Forbidden | "error"» : "User exists" |
Changes users password, requires secured access token
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <sec_token> |
Body params:
Param | Type | Required | Description |
---|---|---|---|
old | string | Yes | Current password |
new | string | Yes | New password. Password has to be between 8 and 128 characters long |
Sample request
curl --request POST 'https://api.testaustime.fi/auth/changepassword' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <sec_token>' \
--data-raw '{
"old": "old_password",
"new": "new_password"
}'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
"new" has < 8 or >132 symbols | 400 Bad Request | {"error": "Password is not between 8 and 132 chars"} |
"old" is incorrect | 401 Unathorized | {"error": "You are not authorized"} |
Regenerates users authentication token, requires secured access token
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Sample request
curl --request POST 'https://api.testaustime.fi/auth/regenerate' \
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <sec_token>'
Sample response
{
"token": "<auth_token>"
}
Response definitions:
Response Item | Type | Description |
---|---|---|
token | string | New Authentication token used for identifying user |
Contains various mostly read-operations with user data
Endpoint | Method | Description |
---|---|---|
/users/@me | GET | Geting data about authorized user |
/users/@me/leaderboards | GET | Geting list of user leaderboards |
/users/{username}/activity/data | GET | Geting user or user friend coding activity data |
/users/{username}/activity/summary | GET | Get a summary of a users activity |
/users/{username}/activity/current | GET | Get a users current coding session |
/users/@me/delete | DELETE | Deleting user account |
Gets data about authorized user
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Sample request
curl --location --request GET 'https://api.testaustime.fi/users/@me' \
--header 'Authorization: Bearer `<auth_token>`'
Sample response
{
"id": 0,
"friend_code": "friend_code",
"username": "username",
"registration_time": "YYYY-MM-DDTHH:MM:SS.ssssssZ"
}
Response definitions:
Response Item | Type | Description |
---|---|---|
id | int | User id |
friend_code | string | With this code other users can add user to the friend list |
username | string | Username |
registration_time | string | Time of registration in ISO 8601 format |
Gets list of user leaderboards
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Sample request
curl --location --request GET 'https://api.testaustime.fi/users/@me/leaderboards' \
--header 'Authorization: Bearer <auth_token>'
Sample response
[
{
"name": "Leaderboard name",
"member_count": 2
}
]
Response definitions:
Response Item | Type | Description |
---|---|---|
name | string | Name of leaderboard in which the user is a member |
member_count | int | Number of users in the leaderboard |
Required headers:
Authorization: Bearer <auth_token>
Geting user or user friend coding activity data
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Path params:
Path param | Description |
---|---|
Username | Own or friend username. Also own username can be replaced on @me |
Sample request
curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/data' \
--header 'Authorization: Bearer <auth_token>'
Sample response
[
{
"id": 0,
"start_time": "YYYY-MM-DDTHH:MM:SS.ssssssZ",
"duration": 0,
"project_name": "project_name",
"language": "language",
"editor_name": "editor_name",
"hostname": "hostname",
"hidden": false
}
]
Response definitions:
Response Item | Type | Description |
---|---|---|
id | int | ID of user code session |
start_time | string | Start time (time of sending first heartbeat) of user code session in ISO 8601 format |
duration | int | Duration of user code session in seconds |
project_name | string | Name of the project in which user have a code session. Empty string if hidden. |
language | string | Code language of the code session |
editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding |
hostname | string | User hostname |
hidden | boolean | Is this project hidden? |
Get a summary of a users activity
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Path params:
Path param | Description |
---|---|
Username | Own or a friends username. Own username can be substituted with @me |
Sample request
curl --location --request GET 'https://api.testaustime.fi/users/@me/activity/summary' \
--header 'Authorization: Bearer <auth_token>'
Sample response
{
"all_time": {
"languages": {
"c": 1000,
"rust": 2000
},
"total": 3000
},
"last_month": {
"languages": {
"c": 100,
"rust": 200,
}
"total": 300
},
"last_week": {
"languages": {
"c": 10,
"rust": 20
},
"total": 30
}
}
Response definitions:
Response Item | Type | Description |
---|---|---|
all_time | Object | All time coding activity summary for the user |
languages | Object | Contains fields named after languages that have the coding time as their value |
total | int | The total coding time of the given period |
last_month | Object | Similar to all_time |
last_week | Object | Similar to all_time and last_month |
Gets details of the ongoing coding session if there is one.
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Path params:
Path param | Description |
---|---|
Username | Own or a friends username. Own username can also be replaced with @me |
Sample request
curl --request GET 'https://api.testaustime.fi/users/@me/activity/current' \
--header 'Authorization: Bearer <auth_token>'
Sample response
{
"started": "YYYY-MM-DDTHH:MM:SS.ssssssZ",
"duration": "10",
"heartbeat": {
"language": "c",
"hostname": "hostname1",
"editor_name": "Neovim",
"project_name": "cool_project22",
"hidden": false
}
}
Response definitions:
Response Item | Type | Description |
---|---|---|
started | string | Start time (time of sending first heartbeat) of user code session in ISO 8601 format |
duration | int | Duration of user code session in seconds |
heartbeat | Object | The HeartBeat object described here |
Deletes user account
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Body params:
Param | Type | Required | Description |
---|---|---|---|
username | string | Yes | Username |
password | string | Yes | User password |
Sample request
curl --request DELETE 'https://api.testaustime.fi/users/@me/delete' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "username",
"password": "password"
}'
Sample response
200 OK
Contains main operations with activity heartbeats on which this service is based on
Endpoint | Method | Description |
---|---|---|
/activity/update | POST | Creating code session and logs current activity in that |
/activity/flush | POST | Flushing any currently active coding session |
/activity/rename | POST | Rename all activities with matching project_name |
/activity/delete | DELETE | Deleting selected code session |
/activity/hide | POST | Hides or reveals all activities with matching project_name |
Main endpoint of the service. Creates code session and logs current activity in that.
The desired interval at which to send heartbeats is immediately when editing a file, and after that at max every 30 seconds, and only when the user does something actively in the editor
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Content-Type | application/json |
Body params:
Param | Type | Description |
---|---|---|
language | string | Code language of the code session |
hostname | string | User hostname |
editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding |
project_name | string | Name of the project in which user have a code session. |
hidden | boolean | Should this project be hidden? |
Sample first request
If the user doesn't have any active code session with this set of body params, then first request POST /activity/update
creates new code session. Any other code session automatically stops/flushes after starting new one, so the user can't have >1 active code sessions in one time
curl --request POST 'https://api.testaustime.fi/activity/update' \
--header 'Authorization: Bearer <auth_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"language": "Python",
"hostname": "Hostname1",
"editor_name": "IntelliJ",
"project_name": "example_project",
"hidden": false
}'
Sample first response
200 OK
Sample next request
curl --request POST 'https://api.testaustime.fi/activity/update' \
--header 'Authorization: Bearer <auth_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"language": "Python",
"hostname": "Hostname1",
"editor_name": "IntelliJ",
"project_name": "example_project",
"hidden": false
}'
Sample next response
200 OK
Body: PT7.420699439S //duration of the user code session in seconds to nanoseconds
Flushes/stops any currently active coding session
Active coding session can be flushed/stoped automatically without any activity updates for a long time. Also can be flushed automatically in case of starting new code session
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Sample request
curl --request POST 'https://api.testaustime.fi/activity/flush' \
--header 'Authorization: Bearer <auth_token>'
Sample response
200 OK
Rename all activities that have a matching project_name
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <auth_token> |
Body params:
| Param | Type | Required | Description | | --- | --- | --- | --- | | from | string | Yes | old name | | to | string | Yes | new name |Sample request
curl --request POST 'https://api.testaustime.fi/activity/rename' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>' \
--data-raw '{
"from": "old_name",
"to": "new_name"
}'
Sample response
{
"affected_activities": 20
}
Response definitions:
| Response Item | Type | Description | | --- | --- | --- | | affected_activities | int | Number of activities renamed |Deletes selected code session, requires secured access token
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Body params:
Param | Type | Description |
---|---|---|
raw text | string | Activity id from response GET /users/{username}/activity/data |
Sample request
curl --request DELETE 'https://api.testaustime.fi/activity/delete' \
--header 'Authorization: Bearer <sec_token>' \
--data-raw 'activity_id'
Sample response
200 OK
Hide or reveal all activities that have a matching project_name
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <auth_token> |
Body params:
| Param | Type | Required | Description | | --- | --- | --- | --- | | target_project | string | Yes | Project name | | hidden | boolean | Yes | Should the project be hidden? |Sample request
curl --request POST 'https://api.testaustime.fi/activity/hide' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <auth_token>' \
--data-raw '{
"project_name": "super_secret_project",
"hidden": true
}'
Sample response
{
"affected_activities": 100
}
Response definitions:
| Response Item | Type | Description | | --- | --- | --- | | affected_activities | int | Number of activities hidden/revealed |Containts CRUD-operations with user friends
Endpoint | Method | Description |
---|---|---|
/friends/add | POST | Adding the holder of the friend_token as a friend of authorized user |
/friends/list | GET | Geting a list of added user friends |
/friends/regenerate | POST | Regenerateing the authorized user's friend code |
/friends/remove | DELETE | Removing another user from user friend list |
Adds the holder of the friend token as a friend of the authenticating user
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Body params:
Param | Type | Description |
---|---|---|
raw text | string | Should contain friend code without any prefixes |
Sample request
curl --request POST 'https://api.testaustime.fi/friends/add' \
--header 'Authorization: Bearer <auth_token>' \
--data-raw 'friend_code'
Sample response
{
"username": "Username",
"coding_time": {
"all_time": 0,
"past_month": 0,
"past_week": 0
},
"status": {
"started": "2023-03-02T12:13:53.121240868",
"duration": 5,
"heartbeat": {
"project_name": "My Project",
"language": "javascript",
"editor_name": "vscode",
"hostname": "mylaptop",
"hidden": false
}
}
}
Error examples:
Error | Error code | Body |
---|---|---|
Friendcode is already used for adding a friend | 403 Forbidden | { "error": "Already friends"} |
Friendcode from body request is not found | 404 Not Found | { "error": "User not found"} |
Friendcode matches with friendcode of authorized user themself | 403 Forbidden | { "error": "You cannot add yourself"} |
Gets a list of added user friends
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Sample request
curl --request GET ''https://api.testaustime.fi/friends/list' \
--header 'Authorization: Bearer <auth_token>'
Sample response
[
{
"username": "username",
"coding_time": {
"all_time": 0,
"past_month": 0,
"past_week": 0
},
"status": {
"started": "2023-03-02T12:13:53.121240868",
"duration": 5,
"heartbeat": {
"project_name": "My Project",
"language": "javascript",
"editor_name": "vscode",
"hostname": "mylaptop",
"hidden": true
}
}
}
]
Response definitions:
Response Item | Type | Description |
---|---|---|
username | string | Friend's username |
coding_time | Object | Coding friend's time by total, past month and past week |
all_time | int | Total duration of user code sessions in seconds |
past_month | int | Total duration of user code sessions in seconds for past month |
past_week | int | Total duration of user code sessions in seconds for past week |
status | Object | Information about the user's current activity |
started | string | Timestamp of when the session start |
duration | int | Duration of user code session in seconds |
heartbeat | Object | Information about the latest heartbeat |
project_name | string | Name of the project in which user have a code session. Empty string if hidden. |
language | string | Code language of the code session |
editor_name | string | Name of IDE (Visual Studio Code, IntelliJ, Neovim, etc.) in which user is coding |
hostname | string | User hostname |
hidden | boolean | Is the project hidden? |
Regenerates the authorized user's friend code, requires secured access token
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Sample request
curl --request POST 'https://api.testaustime.fi/friends/regenerate' \
--header 'Authorization: Bearer <sec_token>'
Sample response
{
"friend_code": "friend_code"
}
Response definitions:
Response Item | Type | Description |
---|---|---|
friend_code | string | New friend code. Using for the all next create friends paire operations |
Removes another user from your friend list, requires secured access token
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Body:
Param | Type | Description |
---|---|---|
raw text | string | Should contain username without any prefixes |
Sample request
curl --request DELETE 'https://api.testaustime.fi/friends/remove' \
--header 'Authorization: Bearer <sec_token>' \
--data-raw 'username'
Sample response
200 OK
Containts CRUD-operations with leaderboards consisting of other Testaustime users
Endpoint | Method | Description |
---|---|---|
/leaderboards/create | POST | Adding new leaderboard |
/leaderboard/join | POST | Joining leaderboard by it's invite code |
/leaderboards/{name} | GET | Getting info about leaderboard if authorized user is a member |
/leaderboard/{name} | DELETE | Deleting leaderboard if authorized user has admin rights |
/leaderboards/{name}/leave | POST | Leaving the leaderboard |
/leaderboards/{name}/regenerate | POST | Regenerating invite code of the leaderboard if authorized user has admin rights |
/leaderboards/{name}/promote | POST | Promoting member of a leaderboard to admin if authorized user has admin rights |
/leaderboards/{name}/demote | POST | Demoting promoted admin to regular member of the leaderboard if authorized user has admin rights |
/leaderboards/{name}/kick | POST | Kicking user from leaderboard if authorized user has root admin rights |
Adds new leaderboard
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Content-Type | application/json |
Body params:
Param | Type | Description |
---|---|---|
name | string | Name of creating leaderboard |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/create' \
--header 'Authorization: Bearer <auth_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "<name>"
}'
Sample response
{
"invite_code": "invite_code"
}
Response definitions:
Response Item | Type | Description |
---|---|---|
invite_code | string | Invite code for joining leaderboard |
Error examples:
Error | Error code | Body |
---|---|---|
"Name" of the leaderboard is already used | 403 Forbidden | { "error": "Leaderboard exists"} |
Joins leaderboard by it's invite code
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Content-Type | application/json |
Body params:
Param | Type | Description |
---|---|---|
invite | string | Invite code for joining leaderboard |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/join' \
--header 'Authorization: Bearer <auth_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"invite": "invite_code"
}'
Sample response
{
"member_count": 0,
"name": "name"
}
Response definitions:
Response Item | Type | Description |
---|---|---|
member_count | int | Number of leaderboard members |
name | string | Leaderboard name |
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is already part of the leaderboard | 403 Forbidden | { "error": "You're already a member"} |
Leaderboard not found by invite code | 404 Not Found | { "error": "Leaderboard not found"} |
Gets info about leaderboard if authorized user is a member
Header params:
Name | Value |
---|---|
Authorization | Bearer <auth_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Sample request
curl --request GET 'https://api.testaustime.fi/leaderboards/{name}' \
--header 'Authorization: Bearer <auth_token>'
Sample response
{
"name": "name",
"invite": "invite_code",
"creation_time": "YYYY-MM-DDTHH:MM:SS.ssssssZ",
"members": [
{
"username": "username",
"admin": true,
"time_coded": 0
}
]
}
Response definitions:
Response Item | Type | Description |
---|---|---|
name | int | Leaderboard name |
invite | int | Invite code for joining leaderboard |
creation_time | string (ISO 8601 format) | Time of leaderboard creation to microsends |
members | array object | Information about leaderboard members |
username | string | Member username |
admin | boolean | Rights of leaderboard member: admin or regular |
time_coded | int | Total duration of user code sessions in second |
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is not part of this leaderboard | 401 Unauthorized | { "error": "You are not authorized"} |
Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} |
Deletes leaderboard if authorized user has admin rights, requires secured access token
Note: Leaderboard can be deleted either by root administrator or by promoted one
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Sample request
curl --request DELETE 'https://api.testaustime.fi/leaderboards/{name}' \
--header 'Authorization: Bearer <sec_token>'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is not part of this leaderboard | 401 Unauthorized | { "error": "You are not authorized"} |
Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} |
Leaves the leaderboard, requires secured access token
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/leave' \
--header 'Authorization: Bearer <sec_token>'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is the last admin in leaderboard | 403 Forbidden | { "error": "There are no more admins left, you cannot leave"} |
User is not the part of the leaderboard | 403 Frobidden | { "error": "You're not a member"} |
Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} |
Regenerates invite code of the leaderboard if authorized user has admin rights, requires secured access token
Header params:
Name | Value |
---|---|
Authorization | Bearer <sec_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/regenerate' \
--header 'Authorization: Bearer <sec_token>'
Sample response
{
"invite_code": "<invite_code>"
}
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} |
Leaderboard not found by name | 404 Not Found | { "error": "Leaderboard not found"} |
Promotes member of a leaderboard to admin if authorized user has admin rights. Be careful of promoting users, root admin (creator of the leaderboard) can be demoted/kicked by a promoted one. Requires secured access token.
*This request is idempotent, it means that you can:
- Promote user that is already admin and have in response 200 OK
- Promote yourself to admin being already admin and have in response 200 OK
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <sec_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Body params:
Param | Type | Description |
---|---|---|
user | string | Username of a leaderboard member you want to promote |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/promote' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <sec_token>' \
--data-raw '{
"user": "<user>"
}'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} |
Promoting user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} |
Demotes admin to regular member in the leaderboard if authorized user has admin rights. Be careful of promoting users, root admin (creator of the leaderboard) can be demoted by a promoted one. Requires secured access token.
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <sec_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Body params:
Param | Type | Description |
---|---|---|
user | string | Username of a leaderboard admin you want to demote |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/demote' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <sec_token>' \
--data-raw '{
"user": "<user>"
}'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} |
Demoting user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} |
Kicks user from leaderboard if authorized user has admin rights, requires secured access token
Header params:
Name | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <sec_token> |
Path params:
Path param | Description |
---|---|
{name} | Leaderboard name |
Body params:
Param | Type | Description |
---|---|---|
user | string | Username of a leaderboard member you want to kick |
Sample request
curl --request POST 'https://api.testaustime.fi/leaderboards/{name}/kick' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <sec_token>' \
--data-raw '{
"user": "<user>"
}'
Sample response
200 OK
Error examples:
Error | Error code | Body |
---|---|---|
Authorized user is not part of found leaderboard or user is not an admin | 401 Unauthorized | { "error": "You are not authorized"} |
Kicking user is not the leaderboard member | 403 Forbidden | { "error": "You're not a member"} |