SWAPI

The Star Wars API

Statistics

People: 87

Planets: 61

Films: 7

Species : 37

Vehicles: 39

Starships: 37

What is this?

The Star Wars API is the world's first quantified and programmatically-formatted set of Star Wars data.

After hours of watching films and trawling through content online, we present to you all the People, Films, Species, Starships, Vehicles and Planets from Star Wars.

We've formatted this data in JSON and exposed it to you in a RESTish implementation that allows you to programmatically collect and measure the data.

Check out the documentation to get started consuming swapi data

What can you use this for?

Comparing the data from Star Wars has never been easier. Here are some examples using the Python helper library

List the planets in order of size:

import swapi
for planet in swapi.get_all("planets").order_by("diameter"):
    print(planet.name)

View the people who have piloted more than one starship:

import swapi
for people in swapi.get_all("people").iter():
    if len(people.starships) > 1:
        print(people.name)

Discover if Jar Jar Binks ruined a film just by being in it:

import swapi
pm = swapi.get_film(4)
jj = swapi.get_person(36)
for c in pm.get_characters().iter():
    if c.name == jj.name:
        print("Why George, why.")

What are the features?

We're using Django and Django REST Framework to serve a RESTish API to you.

The data is all formatted in JSON and we also support JSON Schema for programmatically understanding the attributes of each resource.

We're using stripe to process our donations.

Why did you build this?

I built the Pokémon API before I built this. I realised that if you provide data easily, someone will consume it. I got bored around Christmas 2014 and decided that I'd take what I learned from PokéAPI and build an API for Star Wars data.

Seeing the release trailer for Episode VII also made me stupidly enthusiastic for Star Wars again.

Copyright and stuff?

Star Wars and all associated names are copyright Lucasfilm ltd.

This project is open source and carries a BSD licence.

All data has been freely collected from open sources such as Wookiepedia.

Contributors

SWAPI would not be possible without contributions from the following people:

The Current Server

The code and data originally developed by Paul Hallett and others is now supported in production at scale by Dr. Charles R. Severance on the host https://swapi.py4e.com