2023-10-15 18:54:30 +05:30

126 lines
3.0 KiB
Plaintext

_____________________
Login:-
URL:- /login
Method:- POST
Data Type:- Form Data
Data content:- {
user_name: "<user name>",
password: "<password>"
}
Response:-
200 OK:-
Data:- No
Note:- Assume login completed.
400 Bad Request:-
Content Type:- text/plain
Note:- user_name or password not given a Form Data.
Data:- What is missing will be mentioned.
403 Forbidden:-
Content Type:- text/plain
Note:- user_name or password is wrong, can display the response data to user.
Data:- What is wrong will be mentioned, text that can be displayed on the screen.
Example:-
formData = new FormData();
formData.append('name', 'John');
formData.append('password', 'John123');
fetch(
"/login",
{
body: formData,
method: "post"
}
);
This will give a response status 200 with no data if login is done.
This will return a 403 if the user gave wrong name or password.
_____________________
_____________________
Add User:-
URL:- /add_user
Method:- POST
Data Type:- Form Data
Data content:- {
user_name: "<user name>",
password: "<password>"
}
Response:-
200 OK:-
Data:- No
Note:- Assume success.
400 Bad Request:-
Content Type:- text/plain
Note:- user_name or password not given a Form Data.
Data:- What is missing will be mentioned.
403 Forbidden:-
Content Type:- text/plain
Note:- user_name is exists, can display the response data to user.
Data:- Text that can be displayed on the screen.
Example:-
formData = new FormData();
formData.append('name', 'John');
formData.append('password', 'John123');
fetch(
"/login",
{
body: formData,
method: "post"
}
);
This will give a response status 200 with no data if login is done.
This will return a 403 if the user gave wrong name or password.
_____________________
_____________________
Get Data:-
URL:- /get_data
Method:- POST
Data:- None
Response:-
200 OK:-
Data:- All user data
Note:-
data:- {
entry_name: {
field_name: field_value
}
}
403 Forbidden:-
Data:- Text that can be directly displayed to the user
Note:- Not logged in
Example:-
{
"Amazon": {
"Username": "Kosh",
"Password": "Pass1234"
},
"Matrix": {
"Username": "Kosh",
"Email": "kosh@fake.com",
"id": "@kosh:matrix.com"
}
}
_____________________