-
Git clone the project, enter pokemon folder,
-
Install your python virtual environment:
python3 -m venv .venv
-
Source the environment:
source .venv/bin/activate
-
And install python requirement
pip install -r requirements.txt
-
Migrate the database:
cd overpokeapi
python manage.py migrate
-
Populate the catalog of pokemons and types:
python manage.py populate_catalog
-
Create a super user to access django admin application:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver 0.0.0.0:5555
-
Enter admin application and create user you need:
http://localhost:5555/admin in your favorite browser
POST /api/login
JSON Body must look like and the user must be previously created using admin application
{
"username": "olivier",
"password": "ViveDjango"
}
Response
{
"token": "<your_token>"
}
Before executing request ensure header contains key / value
Authorization: Token <your_token>
GET /api/user/me
Response
{
"user": "olivier",
"types": [
"ground",
"ghost"
]
}
POST /api/group/<type_id>/add
Response has the same structure as View current logged user with added group
POST /api/group/<type_id>/remove
Response has the same structure as View current logged user with removed group
GET /api/pokemon
Response is paginated and show basic information on pokemons
{
"count": 181,
"next": "http://127.0.0.1:5555/api/pokemon?page=2",
"previous": null,
"results": [
{
"poke_id": 27,
"name": "sandshrew",
"url": "https://pokeapi.co/api/v2/pokemon/27/",
"types": [
{
"name": "ground"
}
]
},
...
]
GET /api/pokemon/<pokemon_id_or_name>
Response is the same strucutre as Poke API when requesting an identifed pokemon