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

"URLs should never be constructed by an API client. Instead, the client should only follow links that are generated by the API itself."

I really hate this notion. It makes jumping to page 100 of a 345 page result set impossible. You would literally have to follow 100 pages, or have some ridiculously long index with 345 separate links.

I believe that it should be possible for an API to document a URL formula, and rely on the API client to follow that formula to generate a URL.

That's where things get sticky, though, because as far as I know, there's no good standard defined for how an API can document a dynamic URL formula that is programmatically discoverable.



I'm not sure whether it's a "good" standard, but that doc indirectly links to "URI Templates" [0] It isn't clear to me how that works on the client side however. Can we just assume that clients know how to construct a URI using a template? I guess we can, since it's no more difficult than using the specific API knowledge required to "jump to page 100" as you want to do.

[0] http://tools.ietf.org/html/rfc6570


A search is a resource. We already have media types and schema languages for resources, there's no reason to recreate them for URLs themselves.




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

Search: