- dotdev
- Posts
- Generate Seed Data with the Star Wars API
Generate Seed Data with the Star Wars API
Need sample data for your next app? Tired of using boring fake data? The Star Wars API is the solution for you, and it’s the 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.
The data is available in JSON and exposed through a REST API that allows you to grab the data you need easily. Here is an example from grabbing the user object from http://swapi.co/api/people/1 which returns Luke Skywalker:
{ "name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color": "blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "http://swapi.co/api/planets/1/", "films": [ "http://swapi.co/api/films/2/", "http://swapi.co/api/films/6/", "http://swapi.co/api/films/3/", "http://swapi.co/api/films/1/", "http://swapi.co/api/films/7/" ], "species": [ "http://swapi.co/api/species/1/" ], "vehicles": [ "http://swapi.co/api/vehicles/14/", "http://swapi.co/api/vehicles/30/" ], "starships": [ "http://swapi.co/api/starships/12/", "http://swapi.co/api/starships/22/" ], "created": "2014-12-09T13:50:51.644000Z", "edited": "2014-12-20T21:17:56.891000Z", "url": "http://swapi.co/api/people/1/" }
Utilizing this data in product demos or your development environment will be a lot more fun than just generic fake data. I imagine an integration with the PHP Faker library would very popular.
For full details check out the official site, and it also includes a list of helper libraries for most programming languages.
Reply