Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not every API call is going to follow a succession of links from the main entry point.

Why not?



Performance and simplicity of client code come to mind. If the API is consumed by a UI, it sounds good, particularly if the API provide hypermedia controls that can help generating the UI. But for automated consumption, issuing one call to a know endpoint still seems so much more straightforward than walking down the links graph until the expected link relation is found. I guess I just have to go & try by myself because at this point it seems we don't have much documented experience to rely on.


Yes, but you shouldn't hardcode the known end point, you should cache it after a walk. At some point in the future, it may 404 or 410 on you, in which case you rewalk the API from the entry point, following the link relations that got you to the thing you are after. Then you cache it again.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: