This project is a simple note-taking API built using Django and Django REST Framework. It allows users to create, fetch, query, and update notes.
- Python 3.x
- Django
- Django REST Framework
-
Clone the repository to your local machine:
git clone https://github.com/aman2871/note-taking-project.git
-
Navigate to the project directory:
cd notetakingproject
-
Install the required dependencies:
pip3 install -r requirements.txt
-
Apply migrations to set up the database:
python manage.py makemigrations python manage.py migrate
Start the Django development server:
python manage.py runserver
The API will be accessible at http://localhost:8000/
.
-
Create Note:
- Endpoint:
POST /notes/
- Create a new note by providing a title and body in the request body.
- Endpoint:
-
Fetch Note by ID:
- Endpoint:
GET /notes/<pk>/
- Fetch a note by its primary key.
- Endpoint:
-
Query Notes by Title Substring:
- Endpoint:
GET /notes/?title=<substring>
- Query notes based on a substring present in the note's title.
- Endpoint:
-
Update Note:
- Endpoint:
PUT /notes/<pk>/
- Update the title and body of an existing note identified by its primary key.
- Endpoint:
To run tests, use the following command:
python manage.py test
A Postman collection is provided in the repository (NoteTaking_API.postman_collection.json
). Import it into Postman to test the API endpoints.