blogccasion

Regarding mca's The Cure for URI Construction in your Web API is URI-Templates

Regarding mca's "The Cure for URI Construction in your Web API is URI-Templates"

I saw this pattern recently where a blogger would write up a half-hour-long comment on someone else's blog, but not update his own blog for years, and then wondering why she wouldn't have time to work on her own blog… Recognizing myself here (oh, if you remember where you saw this pattern, too, please ping me so that I can give proper credits). Anyways, I follow Mike Amundsen (@mamund on Twitter) and came across his tweet where he announces his blog post The Cure for URI Construction in your Web API is URI-Templates (Mike, hope you forgive the upper case). First, please read his blog post, then second, if you're still here (or even came back after reading his post), you can read my comment (reposted here, slightly reformatted, corrected the unavoidable typos, and probably introduced some new ones):

Hi Mike,

A note from pedant's corner: in the example:
===
http://www.example.org/messages?d2={date-start}&d2={date-start}&c={category}&o={owner-user-id}&t={title-text}…" rel="query" />
===
you probably meant to write
=== 
<link-template href="http://www.example.org/messages?d1={date-start}&d2={date-end}&c={category}&o={owner-user-id}&t={title-text}…" rel="query" />
===
Note the query parameter names/values and the <link> boilerplate.

Nice write-up besides this. From a REST theorist's point of view I'd say we don't need URI templates at all, because APIs should just have one entry point (and no documented end point[s]). From a REST practicioner's point of view I agree that sometimes you might want to provide a little more guidance…

With regards to query languages honestly I have not yet made my mind entirely up. As long as it is e.g. (sticking to the YQL example):
===
GET http://www.example.org/users?q={encoded-yql-SELECT-statement}
===
I'm probably OK with it, however, as soon as we see things like:
=== 
GET http://www.example.org/users?q={encoded-yql-UPDATE-statement}
===
we are back in the ugly land of tunneling RPC… As I said, I have no final opinion yet, but I'm happy to learn from other commenters here.

Thanks,
Tom

Disclaimer: I'm @tomayac on Twitter and currently work on my PhD. You can track my progress via #TomsPhD.