-
Publicendpoint tolist, search, and orderthe results of StarWars Characters. -
Privateendpoint forUserstolist and addCharacters 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:8002port.
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=-massDevelopment
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=LukeLive Demo
curl https://starwars.jbin.me/api/people/?name=LukeDevelopment
curl http://127.0.0.1:8002/api/people/?planet=TatooineLive Demo
curl https://starwars.jbin.me/api/people/?planet=TatooineDevelopment
curl http://127.0.0.1:8002/api/people/?ordering=-nameLive Demo
curl https://starwars.jbin.me/api/people/?ordering=-name-
Request data arguments:
{ "username": "xxxx", "password": "xxxxxx", "email": "xxxx@xxxx.com" }
Development
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"username": "user2",
"password": "user2password",
"email": "user2@user2.com"}' \
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": "user2@user2.com"}' \
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/activatepip install -r requirements.txtYou 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_peopleDEBUG=Truepython manage.py runserver