swapi
swapi copied to clipboard
Schema Changes Suggestions
Context:
"films": [
"http://swapi.co/api/films/1/",
"http://swapi.co/api/films/2/",
"http://swapi.co/api/films/3/"
],
Relevant section of the schema: https://github.com/phalt/swapi/blob/master/resources/schemas/people.json#L43
While listing out the films is a starting point, using HAL - http://stateless.co/hal_specification.html - would make this much more powerful. Check out the heading "Representing Multiple Links With The Same Relation" because structuring the JSON like this would allow more flexibility in displaying data without causing the client to make more requests.
_items: {
"films": [{
"name": "A New Hope",
"href": "/films/1/"
},{
"name": "The Empire Strikes Back",
"href": "/films/2/"
}]
}
I'd also apply this to the species, vehicles, planets subresources but I wanted to give a single example.
I'd love to do this, I wonder if there is a plugin for Django REST Framework that would make this super easy?
Accepted into version 2