-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include id for a given resource in list view #84
Comments
Why isn't the url sufficient enough? You would have to construct the URL anyway with the ID param? It's actually more HATEOAS (http://phalt.co/what-is-hateoas/) to use full URLs and not IDs :) |
For a basic API (which SWAPI is), providing the URL is sufficient. However, in a more powerful and complicated structure, having access to the id is crucial. For example, you could expand the functionality of your planets service. Maybe it could take an array of character IDs and return a list of all the planets those characters have every visited. The ability to compose IDs with services is crucial in modern API architecture. A model shouldn't have to provide a URL for every place that it can be used. This clearly isn't crucial for SWAPI. But I often use SWAPI when teaching developers to consume APIs. Having SWAPI act a bit more like the average API would definitely be helpful. |
I'm currently implementing an APL-Wrapper for SWAPI and was surprised by the same. |
hi @mbaas2 , have you created the IDs from the URL parameter? I will be so thankfull if you can give me a snippet from your code. Thanks! |
@luismigil Sure, no problem: it's here. |
For example, when querying
/people
, the individual records don't have anid
property, but this would be terribly useful and be in line with common RESTful api practice. It would be more useful for using SWAPI as a fake backend to test some front end functionality than simply relying on theurl
field.The text was updated successfully, but these errors were encountered: