A simple note taking API for Django that supports creating notes and a folder structure. Built for the purpose of learning how to use the Django REST Framework to build a CRUD API.
- Notes and folder structure
- Per item owners
- Integrated Django permissions
Planned Features
- Revision history
- Bearer token support
- Note sharing
- Ownership transfer
- Install with pip.
$ pip install marknote
- Modify your
INSTALLED_APPS
in settings.py.
INSTALLED_APPS = [ 'rest_framework', 'rest_framework.authtoken', 'marknote', ]
- Modify you
urlpatterns
in urls.py.
from django.urls import include, re_path urlpatterns = [ re_path(r'^marknote/', include(('marknote.urls', 'marknote'), namespace='marknote')) ]
- Run migrations.
$ python manage.py migrate
5. In the Django admin panel, generate a new token for the desired user. If they are not a superuser then they will need the MarkNote permissions added to their user.
The request expects an Authorization
header with the value of Token xxx
where xxx
is your token. This
will be changed in the future to add Bearer token support.
Documentation can be found here. Refer to the
docs
folder for the OpenAPI specification file.
There are four different endpoints for the API. The marknote
portion of the URI can be mapped using the Django
urls.py file. It is setup as shown in the sample project.
- /marknote/note
- The create and list endpoint used to create and list all notes.
- /marknote/note/{id}
- The retrieve, update, and destroy endpoint used to access individual notes.
- /marknote/folder
- The create and list endpoint used to create and list all folders.
- /marknote/folder/{id}
- The retrieve, update, and destroy endpoint used to access individual folders.
To run the unit tests, simply use the Django test command with Pipenv.
$ pipenv install $ pipenv run python manage.py test