-
Public
endpoint tolist, search, and order
the results of StarWars Characters. -
Private
endpoint forUsers
tolist and add
Characters to their favorites with JWT authentication available in production mode.
In development mode for convenience you can employ BasicAuth to test authenticated routes. A local SQLite DB will be created if DATABASE_URL is not defined. Development mode runs on:8002
port.
Live Demo: Hosted in a DigitalOcean VM with a cloud Postgres instance in aiven.io.
Available on: https://starwars.jbin.me/api/
Live Demo Example:
https://starwars.jbin.me/api/people/?planet=Tatooine&ordering=-mass
Development
curl http://127.0.0.1:8002/api/people/
Live Demo
curl https://starwars.jbin.me/api/people/
Development
curl http://127.0.0.1:8002/api/people/?name=Luke
Live Demo
curl https://starwars.jbin.me/api/people/?name=Luke
Development
curl http://127.0.0.1:8002/api/people/?planet=Tatooine
Live Demo
curl https://starwars.jbin.me/api/people/?planet=Tatooine
Development
curl http://127.0.0.1:8002/api/people/?ordering=-name
Live Demo
curl https://starwars.jbin.me/api/people/?ordering=-name
-
Request data arguments:
{ "username": "xxxx", "password": "xxxxxx", "email": "[email protected]" }
Development
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"username": "user2",
"password": "user2password",
"email": "[email protected]"}' \
http://127.0.0.1:8002/api/auth/users/
Live Demo
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"username": "user2",
"password": "user2password",
"email": "[email protected]"}' \
https://starwars.jbin.me/api/auth/users/
-
Request data arguments:
{ "username": "xxxx", "password": "xxxxxx" }
Live Demo
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"username": "user2", "password": "user2password"}' \
https://starwars.jbin.me/api/auth/token/
-
Request data arguments :
List of Character IDs:{ [id1, id2, ...] }
Development
curl \
-X POST \
-u user2:user2password \
-H "Content-Type: application/json" \
-d '[1, 2, 3]' \
http://127.0.0.1:8002/api/people/favorites/
Live Demo
curl \
-X POST \
-H "Authorization: Bearer {acccess token}" \
-H "Content-Type: application/json" \
-d '[1, 2, 3]' \
https://starwars.jbin.me/api/people/favorites/
Development
curl \
-u user2:user2password \
http://127.0.0.1:8002/api/people/favorites/
Live Demo
curl \
-H "Authorization: Bearer {acccess token}" \
https://starwars.jbin.me/api/people/favorites/
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
You need to run load_people
manage.py command after migrate. This needs to run one time to fetch the data from swapi.dev and populate the database.
python manage.py migrate
python manage.py load_people
DEBUG=True
python manage.py runserver