!! IN PROGRESS !!
A simple articles HTTP api built with django + django rest framework (+ requests for client examples).
- Clone git repository
- (Optional) Create a Python virual environment and activate it (py version in runtime.txt)
- Install requirements
- Change directory to myapi
- Make migrations and migrate
- Run server
$ git clone https://github.com/stefanoandroni/myapi-django
$ cd myapi-django
$ pip install -r requirements.txt
$ cd src\myapi
$ py manage.py makemigrations
$ py manage.py migrate
$ py manage.py runserver
CRUD views (and endpoints) kept separate for learning purposes.
api/ | ||||
auth/ | POST | authentication | ||
register/ | POST | registration | ||
articles/ | GET | articles list | ||
create/ | POST | create article | ||
<slug:article_slug>/update/ | PUT | update article | ||
<slug:article_slug>/delete/ | DELETE | delete article | ||
<slug:article_slug>/ | GET | article detail | ||
comments/ | GET | all comments list | ||
<int:id>/delete/ | DELETE | delete comment | ||
<int:id>/update | PUT | update comment | ||
<int:id>/ | GET | comment detail | ||
<slug:article_slug>/create/ | POST | comment create | ||
<slug:article_slug>/ | GET | article comments list | ||
search/ | ?q=QUERY&topic=TOPIC&author=AUTHOR | GET | search |
- rest_framework.authentication.SessionAuthentication
- api.authentication.TokenAuthentication Example Token Authentication example in src\client\utils.py
- rest_framework.permissions.IsAuthenticated Note Accessing any API endpoint requires authentication
Client examples in src\client.
$ cd src\client
$ py file_name.py
- implement Users CRUD