Exemplo de API feita em Django Rest Framework.
- Clone esse repositório.
- Crie um virtualenv com Python 3.
- Ative o virtualenv.
- Instale as dependências.
- Rode as migrações.
git clone https://github.com/jobconvo/DEV-IMPACT-01-DRF.git dev-impact-01-drf
cd dev-impact-01-drf
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python contrib/env_gen.py
python manage.py migrate
python manage.py createsuperuser --username="admin" --email=""
No Admin crie seu Token. Ou pelo terminal:
python manage.py drf_create_token admin
http://localhost:8000/swagger/
GET: http://localhost:8000/api/users/1/
Headers > key: Authorization , value: 'Token <seu_token>'
POST: http://localhost:8000/api/users/
Body > raw > JSON
{
"email": "user@example.com",
"first_name": "string",
"last_name": "string",
"password": "string"
}
- https://www.django-rest-framework.org/tutorial/quickstart/
- http://pythonclub.com.br/django-rest-framework-quickstart.html
- http://www.cdrf.co/3.9/rest_framework.viewsets/ModelViewSet.html
- https://www.django-rest-framework.org/api-guide/generic-views/#modelviewset
- https://www.django-rest-framework.org/api-guide/viewsets/
- http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#perform_create
- https://drf-yasg.readthedocs.io/en/stable