LetsNote is a note keeping web app that lets you keep track of your notes.
If you're a new user, you will be required to register to the app. Existing users can simply log in.
You can perform CRUD operations in this web app. That is, the user can create, read, update, and delete new or existing notes.
The user can create new notes by simply pressing the "Add Note" button in the navbar. The user is required to add a title, some content and optional tags to distinguish the note from other notes.
The title of the note is a hyperlink to a page where the complete contents of the note is visible.
On the detail page, the user is provided with an edit option, where he/she can change the title, the note's content, and even the tags associated with that note.
The user is also provided with a delete option which will delete the note.
There is a search bar on the home page which can filter your notes based on the tags associated with it. On the home page, the tags of each note are also hyperlinks which pass that tag into the search functionality.
The user is provided with a profile, where he/she can change their first name, last name and email address. The user also has the option of deleting their profile, which will delete their complete account.
While logging in, if the user has forgotten their password, they have the option of resetting it, by clicking the "Forgot Password?" option on the login page.
To setup LetsNote on your system, follow the steps below.
- Clone the repo.
git clone https://github.com/JekyllAndHyde8999/LetsNote.git
- Go into the LetsNote directory.
cd LetsNote
- Install dependencies
- If you use pipenv,
This will create a new virtual environment and install all the dependencies.pipenv install
- If you use pip,
pip install -r requirements.txt
- Migrate and start server
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver
Base URL: http://127.0.0.1:8000/api/
For a registered user to obtain their auth token
Request Format
With cURL:
curl -X POST -d '{"username": "$USERNAME", "password": "$PASSWORD"}' http://127.0.0.1:8000/api/api-token-auth/
With Python-Requests:
requests.post(
url="http://127.0.0.1:8000/api/api-token-auth/",
data={
"username": "$USERNAME",
"password": "$PASSWORD"
}
)
Response Format
{
"token": "$TOKEN"
}
To get the details of the authenticated user
Request Format
With cURL:
curl -X GET -H "Authorization: Token $TOKEN" http://127.0.0.1:8000/api/users/
With Python-Requests:
requests.get(
url="http://127.0.0.1:8000/api/users/",
headers={
"Authorization": "Token $TOKEN"
}
)
Response Format
{
"first_name": $FIRST_NAME,
"last_name": $LAST_NAME,
"username": $USERNAME,
"email": $EMAIL,
"password": $PASSWORD
}
password in the above response is not the actual password, but its hash.
To register as a new user
Request Format
With cURL:
curl -X POST -d '{"user": {"username": "$USERNAME", "password": "$PASSWORD", "email": "$EMAIL"}}' http://127.0.0.1:8000/api/users/
With Python-Requests:
requests.post(
url="http://127.0.0.1:8000/api/users/",
data={
"user": {
"username": "$USERNAME",
"password": "$PASSWORD",
"email": "$EMAIL"
}
}
)
Response Format
{
"success": "User $USERNAME created successfully.",
"token": $TOKEN
}
To update your email or username. (Email and username fields are unique in our database. If this API is called with an email or username that already exists in the database, the request will not be completed.)
Request Format
With cURL:
curl -X PUT -H "Authorization: Token $TOKEN" -d '{"user": {"username": "$USERNAME", "email": "$EMAIL"}}' http://127.0.0.1:8000/api/users/
With Python-Requests:
requests.put(
url="http://127.0.0.1:8000/api/users/",
headers={
"Authorization": "Token $TOKEN"
},
data={
"user": {
"username": "$USERNAME",
"email": "$EMAIL"
}
}
)
Response Format
{
"success": "User $USERNAME details updated successfully."
}
Calling this API will delete your entire account (including the profile and all the notes).
Request Format
With cURL:
curl -X DELETE -H "Authorization: Token $TOKEN" http://127.0.0.1:8000/api/users/
With Python-Requests:
requests.delete(
url="http://127.0.0.1:8000/api/users/",
headers={
"Authorization": "Token $TOKEN"
},
data={
"note":{
"id": $NOTE_ID
}
}
)
Response Format
{
"success": "User $USERNAME deleted successfully."
}
Returns a list of all notes belonging to the authenticated user.
Request Format
With cURL:
curl -X GET -H "Authorization: Token $TOKEN" http://127.0.0.1:8000/api/notes/
With Python-Requests:
requests.get(
url="http://127.0.0.1:8000/api/notes/",
headers={
"Authorization": "Token $TOKEN"
}
)
Response Format
[
{
"pk": $PK,
"title": $TITLE,
"note_text": $NOTE_TEXT,
"tags": [
$TAGS
],
"last_modified": $LAST_MODIFIED
} (for each note)
]
To create a note belonging to the authenticated user.
Request Format
With cURL:
curl -X POST -H "Authorization: Token $TOKEN" -d '{"note": {"title": $TITLE, "note_text": $NOTE_TEXT, "tags": [$TAGS]}}' http://127.0.0.1:8000/api/notes/
With Python-Requests:
requests.post(
url="http://127.0.0.1:8000/api/notes/",
headers={
"Authorization": "Token $TOKEN"
},
data={
"note": {
"title": $TITLE,
"note_text": $NOTE_TEXT,
"tags": [
$TAGS
]
}
}
)
Response Format
{
"pk": $PK,
"title": $TITLE,
"note_text": $NOTE_TEXT,
"tags": [
$TAGS
],
"last_modified": $LAST_MODIFIED
}
To update the content of a note (title, note_text, tags). Including all 3 fields in the request is not mandatory. Any of the fields can be updated at a time.
Request Format
With cURL:
curl -X PUT -H "Authorization: Token $TOKEN" -d '{"note": {"pk": $PK, "title": $TITLE, "note_text": $NOTE_TEXT, "tags": [$TAGS]}}' http://127.0.0.1:8000/api/notes/
With Python-Requests:
requests.put(
url="http://127.0.0.1:8000/api/notes/",
headers={
"Authorization": "Token $TOKEN"
},
data={
"note": {
"pk": $PK
"title": $TITLE,
"note_text": $NOTE_TEXT,
"tags": [
$TAGS
]
}
}
)
Response Format
{
'success': 'Note $TITLE updated successfully'
}
To delete a particular note belonging to an authenticated user.
Request Format
With cURL:
curl -X DELETE -H "Authorization: Token $TOKEN" -d '{"note": {"pk": $PK}}' http://127.0.0.1:8000/api/notes/
With Python-Requests:
requests.delete(
url="http://127.0.0.1:8000/api/notes/",
headers={
"Authorization": "Token $TOKEN"
},
data={
"note": {
"pk": $PK
}
}
)
Response Format
{
'success': 'Note $TITLE deleted successfully'
}