API Base Url: https://restapi.praveenms.site
This Repo has only Backend codes for the notes app(Soon it'll be available as python app or android app) which follows OAuth 2.0, REST API Protocols.
POST /auth/login
Attribute | Description |
---|---|
username | Can be username or email address of the registered user |
password | Password provided by the user |
There are 3 type of responses each associated with a status code.
Status Code | Description |
---|---|
200 | Login ok, token should be returned in response. |
406 | Something is wrong. Check response for error message. |
400 | Bad request format or not all attributes are provided. |
To all the subsequent requests that perform CURD on Notes and Folder, you should pass the access_token
over your header like the following
Authorization: Bearer <access_token>
Authorization: Bearer a.3f8f961077b54e0e76251dafd678qw34af00adf7d4418b2524bc2334fb1938f1
{
"message": "Login success",
"tokens": {
"access_token": "a.3f8f961077b54e0e76251dafd678qw34af00adf7d4418b2524bc2334fb1938f1",
"valid_for": 7200,
"refresh_token": "r.c7628b62bfbe5e19f101b2re893c27741dc504935527cf4d652aeaf28e8d178a",
"reference_token": "auth_grant",
"type": "api"
}
}
{
"error": "Detailed error message"
}
{
"error": "Bad request"
}
POST /auth/refresh
Attribute | Description |
---|---|
refresh_token | <refresh_token_acquired_during_login> |
There are 3 type of responses each associated with a status code.
Status Code | Description |
---|---|
200 | Refresh access is successful, token should be returned in response. |
406 | Something is wrong. Check response for error message. |
400 | Bad request format or not all attributes are provided. |
To check if an access_token
is valid, you can use Get Current User API.
{
"message": "Refresh Success",
"tokens": {
"access_token": "a.fcd25683d077219e29ef990f79ddff8946495186a9773af1e4bee633a0b99a5b",
"valid_for": 7200,
"refresh_token": "d.cf03600e7e505af7c4e90120838a05a3",
"reference_token": "r.786906ede70648bccc44af4d13a461f87e0331d080565fbe1fd2ac21ea2e524c",
"type": "api"
}
}
{
"error": "Detailed error message"
}
{
"error": "Bad request"
}
POST /auth/signup
Attribute | Description |
---|---|
username |
Any username without space, and must be alpha numeric. Some symbols are allowed. |
password |
Any password greater than 8 characters |
email |
Email address of the user to which verification is sent. Must be a valid one. |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | Signup Success and verification email sent. |
400 | Bad Request Format or Not all attributes are available. |
409 | User already exists |
{
"message": "Signup success",
"userid": 41
}
{
"error": "Bad request"
}
{
"error": "Unable to signup."
}
Can be used to check the validity of the access token.
POST /auth/current
There are 3 types of responses.
Status Code | Description |
---|---|
200 | Name of the user will Display |
403 | unauthorized user |
400 | Bad request or Token expired |
{
"username": "name of the user"
}
{
"error": "unauthorized user"
}
{
"error": "Expired token" or "error": "Bad request"
}
POST /notes/get
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
Token |
Need to provide the token which generated during the login |
id |
Need to provide id of that paticular note. |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | success, Notes related to that id will be displayed. |
403 | unauthorized user. |
400 | Bad Request Format or Not all attributes are available. |
{
"title": "hello world"
"body": "hi hello world"
"created": "1 day ago"
}
{
"error": "Bad request"
}
...
POST /auth/Edit
Attribute | Description |
---|---|
Note_search_Term |
Need of paticular NoteId (or) Title (or) Body |
| Token
| Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | User can modify the existing data. |
403 | unauthorized user. |
400 | Bad Request Format or Not all attributes are available. |
{
"id": "1"
"name": "lahtp notes"
"owner": "lahtp"
"created_at": "1 day ago"
"modified_at": "1 hour ago"
}
{
"error": "Bad request"
}
POST /auth/delete
Attribute | Description |
---|---|
Note_search_Term |
Need of paticular NoteId (or) Title (or) Body |
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | User can modify the existing data. |
403 | unauthorized user. |
400 | Bad Request Format . |
{
"message": "success"
}
{
"error": "Bad request"
}
POST /auth/get
Attribute | Description |
---|---|
Note_search_Term |
Need of paticular NoteId (or) Title (or) Body |
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | User can modify the existing data. |
403 | unauthorized user. |
400 | Bad Request Format . |
{
id": "33",
"title": "Dummy note 1",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin quis convallis erat. Aenean
posuere condimentum efficitur.",
"created": "21 minutes ago",
"updated": "21 minutes ago"
}
{
id": "34",
"title": "Dummy note 2",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin quis convallis erat. Aenean
posuere condimentum efficitur.",
"created": "21 minutes ago",
"updated": "21 minutes ago"
}
{
"error": "Bad request"
}
POST /folder/new
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
Token |
Need to provide the token which generated during the login |
Name |
Need to provide the name of the folder. |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | Folder created successfully. |
403 | unauthorized user. |
400 | Bad Request Format or Not all attributes are available. |
{
"folder_id": 13
}
{
"error": "Bad request"
}
POST /folder/get_all_notes
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | success it will list all the notes |
403 | unauthorized user. |
400 | Bad Request Format or Not all attributes are available. |
{
"count": "2",
"notes": [
"id": "1"
"name": "lahtp notes"
"owner": "lahtp"
"created_at": "1 day ago"
"modified_at": "1 hour ago"
"id": "2"
"name": "lahtp notes 2"
"owner": "lahtp"
"created_at": "1 day ago"
"modified_at": "1 hour ago"
]
}
{
"error": "Bad request"
}
POST /auth/delete
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
Note_search_Term |
Need of particular folder Id (or) Title (or) Body |
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | success data deleted. |
403 | unauthorized user. |
400 | Bad Request Format . |
{
"message": "success"
}
{
"error": "Bad request"
}
GET /folder/get
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
id |
need to provide the id of particular folder |
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | User can modify the existing data. |
403 | unauthorized user. |
400 | Bad Request Format . |
{[
{
"id": "12",
"name": "Default Folder",
"owner": "lahtp",
"created_at": "2021-05-19 23:48:22",
"created": "18 minutes ago",
"count": "0"
},
{
"id": "13",
"name": "Personal Notes",
"owner": "lahtp",
"created_at": "2021-05-19 23:49:14",
"created": "18 minutes ago",
"count": "0"
},
{
"id": "14",
"name": "Personal Notes",
"owner": "lahtp",
"created_at": "2021-05-20 00:05:45",
"created": "1 minute ago",
"count": "0"
}
]
}
{
"error": "Bad request"
}
post /Folder/rename
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
id |
need to provide the id of particular folder |
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | User can modify the existing data. |
403 | unauthorized user. |
400 | Bad Request Format . |
{
"id": "1"
"name": "lahtp notes"
"owner": "lahtp"
"created_at": "1 day ago"
"modified_at": "1 hour ago"
}
{
"error": "Bad request"
}
post /Folder/delete
Authorization: Bearer <your_access_token>
Attribute | Description |
---|---|
id |
need to provide the id of particular folder |
Token |
Need to provide the token generated during login |
There are 3 types of responses.
Status Code | Description |
---|---|
200 | operation successful |
403 | unauthorized user. |
400 | Bad Request Format . |
{
"message": "success"
}
{
"error": "Bad request"
}