API for Note Management application
docker-compose up -d --buildpip install poetrycd src && poetry installpoetry shellpython manage.py runserverexport $(grep -v "^#" .env.local | xargs)pytestdocker-compose up -d --build
pip install poetry
cd src && poetry install
poetry shell
python manage.py runserver- Go to http://localhost:8000/api/docs/
- After sign_up or sign_in use the token from the response body and place it in the Authorize form with the pattern
Token {your_token}
- Use swagger
- Sign up
curl -X 'POST' \
'http://localhost:8000/api/auth/sign_up/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"username": "string",
"password": "string"
}'Response body
{
"pk": 1,
"username": "string",
"is_active": true,
"token": "95bf3f893540a8743710cee91afe7ae20542c4f4"
}After sign_up use the token from the response body and place it in the Authorization header with the pattern
Token {your_token}
- Create note
curl -X 'POST' \
'http://localhost:8000/api/notes/' \
-H 'accept: application/json' \
-H 'Authorization: Token your_token' \
-H 'Content-Type: application/json' \
-d '{
"name": "string",
"description": "string"
}'Response body
{
"pk": 1,
"name": "string",
"description": "string",
"created_at": "2023-03-13T08:25:21.876016Z"
}- Get own notes
curl -X 'GET' \
'http://localhost:8000/api/notes/' \
-H 'accept: application/json' \
-H 'Authorization: Token your_token'Response body
[
{
"pk": 1,
"name": "string",
"description": "string",
"created_at": "2023-03-13T08:25:21.876016Z"
}
]- Get own note by id = 1
curl -X 'GET' \
'http://localhost:8000/api/notes/1/' \
-H 'accept: application/json' \
-H 'Authorization: Token your_token'Response body
{
"pk": 1,
"name": "string",
"description": "string",
"created_at": "2023-03-13T08:25:21.876016Z"
}- Update own note by id = 1
curl -X 'PATCH' \
'http://localhost:8000/api/notes/1/' \
-H 'accept: application/json' \
-H 'Authorization: Token your_token' \
-H 'Content-Type: application/json' \
-d '{
"name": "string",
"description": "string"
}'Response body
{
"pk": 1,
"name": "string",
"description": "string",
"created_at": "2023-03-13T08:25:21.876016Z"
}- Delete own note by id
curl -X 'DELETE' \
'http://localhost:8000/api/note/1/' \
-H 'accept: application/json' \
-H 'Authorization: Token your_token' \Response body - no body
- Sign in
curl -X 'POST' \
'http://localhost:8000/api/auth/sign_in/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"username": "string",
"password": "string"
}'Response body
{
"pk": 1,
"username": "string",
"is_active": true,
"token": "95bf3f893540a8743710cee91afe7ae20542c4f4"
}After sign_in use the token from the response body and place it in the Authorization header with the pattern
Token {your_token}
- Sign out
curl -X 'POST' \
'http://localhost:8000/api/auth/sign_out/' \
-H 'accept: application/json' \
-H 'Authorization: Token your_token'Response body - no body