2024-08-26 18:37:38 +05:30

141 lines
2.8 KiB
Plaintext

Legend:
Form data:
https://developer.mozilla.org/en-US/docs/Web/API/FormData
[something] : this something is optional
---------- USER HANDLING ----------
POST : /get-user-by-email
Form data:
email
return type:
{
"handle": "~",
"display_name": "~"
}
Errors:
422 : email missing in request
404 : email not found
POST : /get-user-by-id
Form data:
id
return type:
{
"handle": "~",
"display_name": "~"
}
Errors:
422 : id missing in request
404 : id not found
POST : /get-user-by-handle
Form Data:
handle
return type:
{
"handle": "~",
"display_name": "~"
}
Errors:
422 : handle missing in request
404 : handle not found
POST : /register
Form Data:
email
handle
password
[display_name]
[profile_picture]
Errors:
422 : something missing in request
409 : User exists (email or handle)
POST : /login
Form Data:
email
password
Errors:
422 : something missing in request
404 : User does not exist
409 : Wrong password
Cookies:
sets id
sets session_id
POST : /logout
Errors:
401 : Not logged in
Cookies:
deletes session_id
deletes id
POST : /change-user-profile-picture
Form Data:
image
Errors:
401 : Not logged in
403 : Invalid log in
422 : image is missing
Note:
Must be logged in
POST : /change-user-display-name
Form Data:
display_name
Errors:
401 : Not logged in
403 : Invalid log in
422 : display_name is missing
Note:
Must be logged in
GET : /profile-picture/<handle>
Errors:
404 : Handle not found
---------- BOUNTY HANDLING ----------
POST : /create-bounty
Form Data:
title
description
[field]
[language]
Errors:
422 : something missing in request
403 : Unknown language/ field
Note:
default language = "any"
default field = "other"
POST : /get-user-by-id
Form data:
id
return type:
{
"handle": "~",
"display_name": "~"
}
Errors:
422 : id missing in request
404 : id not found
POST : /create-session-for-bounty-get-random
Cookies:
sets bounty_session_id
POST : /bounty-get-random
Form data:
page_number
Note:
/create-session-for-bounty-get-random must be called before this
Errors:
422 : page no. missing in request
404 : /create-session-for-bounty-get-random not called