swapi icon indicating copy to clipboard operation
swapi copied to clipboard

Return name in addition to URL array

Open romanrast opened this issue 9 years ago • 2 comments

Hi is it possible to return the resource name of the array elements in addition to the url like when calling: http://swapi.co/api/films/1/
we get an array of planets, species, starships, vehichles and characters. It would be great if we could receive not only an array of URL like:
["http://swapi.co/api/planets/8/", "http://swapi.co/api/planets/9/", "http://swapi.co/api/planets/1/"]

but also the names of the planets like: ["Naboo", "Coruscant", "Tatooine"]

romanrast avatar Apr 24 '15 09:04 romanrast

This has been proposed before, and Django REST Framework supports some nested attributes. Happy to accepted a pull request with the changes so long as it does not change any existing attributes.

phalt avatar Apr 24 '15 09:04 phalt

This would be great. or event if as parameter or option when doing a query.

For example http://swapi.co/api/people/?shownames=1

@mdhorda, could you do a pull request?

gianpaj avatar Sep 14 '16 16:09 gianpaj