From: Arlo Belshee <Arlo.Bels...@microsoft.com>
Date: Mon, 9 Apr 2012 22:35:08 +0000
Local: Mon, Apr 9 2012 6:35 pm
Subject: RE: One Meta URL to Rule Them All?
That was one of many lessons we learned with v2. Now we have a way to state the canonical URL for the metadata doc, but originally we just used it as the one well-known URL (we left the behavior of the service root undefined, figuring that services would want to do things with that). Turns out we were wrong, and people wanted `/` to give a standardized service doc that has a ref to the metadata doc. So now we have both (for back compat). Arlo From: api-craft@googlegroups.com [mailto:api-craft@googlegroups.com] On Behalf Of mca IMO, a better approach if too use "meta" affordance. Clients can recognize the control and servers are free to use any URL they wish including ones in other namespaces (domains) and URLs that match languages, etc. Mike Amundsen We found there were good reasons to not put the metadata at root. Similarly, we didn't want to corrupt the API surface (since we were making an API for arbitrary services). So we named the metadata `/$metadata` (by default convention - a link from the root provides the real value). There are still a whole bunch of details to work out from there (such as what does $metadata contain?). Most of the design at this point was in-house, so I'm not sure how much you'll be able to glean from the old blog posts (which don't go back before 2010 anyway). However, most of the designers who were thinking this stuff through prior to 2010 are still with us. They'd be happy to share some lessons learned if you wanted. I am definitely in favor of using metadata to drive a web API. It can make the system open for client extension, while still leaving the server in control of what's allowed and how that is done. There are just a ton of details involved in getting it right - many of which we learned by getting them wrong and then having to fix it while maintaining backwards compatibility even on the metadata document. Arlo From: api-craft@googlegroups.com<mailto:api-craft@googlegroups.com> [mailto:api-craft@googlegroups.com<mailto:api-craft@googlegroups.com>] On Behalf Of Mike Schinkel Changed the subject to recognize the change in topic. On Apr 9, 2012, at 4:39 PM, Jørn Wildt wrote: >I was actually suggesting URL construction - but by letting the client >fetch the URL template from the service instead of hardwiring the >templates into the client. But, yes, it is one extra indirection. Unfortunately those indirections can be expensive in too many use-cases, such as for mobile devices. Good point. The problem can, to some extend, be mitigated by caching and use of ETAG for conditional requests. Then you only pay the penalty once - probably at the time of installing the mobile app in which case you should have plenty of bandwith. Here's a thought that I wonder if anyone is considering? Rather than encoding the link templates into each response, what about offering them via an API-wide resource that could by-convention be retrieved from the API root: { } That would mean the client only needs to request the meta once. This approach could of course be extended to include external references in the meta response for those huge APIs where it's too big to force mobile devices to download, much how conceptually a sitemap.xml can be partitioned into multiple files. Further, the root could indicate another resource for meta if need be, { } Individual responses could provide a link back to their meta data, but it would be *optional*: { } Another benefit of this approach is that it would layer over any existing API, i.e. Twitter's. And that would allow someone to create a meta file for any existing API that could be made available to the client even of the API provider does not support HATEOAS. So if I want my client to be hypertext driven I can even hardcode into my client the meta for a given API that is not HATEOAS and/or I could code my client to retrieve the meta from my own servers in the case I want my client to be more resilient to change. This approach would allow good tools to emerge because it's an incremental approach; it doesn't try to boil the ocean. Thoughts? -Mike You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||