AtomPub support in the ADO.NET Data Services Framework
We have been looking for the last few months at adding first-class support for AtomPub to Project Astoria (we briefly touched on it before here). We are at a point where we have some parts of the AtomPub story and their initial implementation running (and we’ll share fresh experimental bits soon), some parts on the design board and other parts that we haven’t explored yet. I wanted to write a few words to explain why we think AtomPub support is important and enumerate the challenges we face. Guidance and general feedback on the reasoning, the approach and on the details is very much appreciated.
Why are we looking at AtomPub?
Astoria data services can work with different payload formats and to some level different user-level details of the protocol on top of HTTP. For example, we support a JSON payload format that should make the life of folks writing AJAX applications a bit easier. While we have a couple of these kind of ad-hoc formats, we wanted to support a pre-established format and protocol as our primary interface.
If you look at the underlying data model for Astoria, it boils down to two constructs: resources (addressable using URLs) and links between those resources. The resources are grouped into containers that are also addressable. The mapping to Atom entries, links and feeds is so straightforward that is hard to ignore. Of course, the devil is in the details and we’ll get to that later on.
The interaction model in Astoria is just plain HTTP, using the usual methods for creating, updating, deleting and retrieving resources. Furthermore, we use other HTTP constructs such as “ETags” for concurrency checks, “location” to know where a POSTed resource lives, and so on. All of these also map naturally to AtomPub.
From our (Microsoft) perspective, you could imagine a world where our own consumer and infrastructure services in Windows Live could speak AtomPub with the same idioms as Astoria services, and thus could both have a standards-based interface and also use the same development tools and runtime components that work with any Astoria-based server. This would mean less clients/development tools for us to create and more opportunity for our partners in the libraries and tools ecosystem out there.
How are we approaching this?
We are simply mapping whatever we can to regular AtomPub elements. Sometimes that is trivial, sometimes we need to use extensions and sometimes we leave AtomPub alone and build an application-level feature on top. Here is an initial list of aspects we are dealing with in one way or the other. We’ll also post elaborations of each one of these to the appropriate Atom syntax|protocol mailing lists.
a) Mapping the data model: how do we map Astoria’s underlying data model, the Entity Data Model, to Atom constructs. This is quite straightforward but it deserves a look for completeness.
b) We use just the regular format/protocol whenever we can, we would be interested in validating our use with folks out there
c) Using AtomPub constructs and extensibility mechanisms to enable Astoria features:
· Inline expansion of links (“GET a given entry and all the entries related through this named link”, how we represent a request and the answer to such a request in Atom?).
· Properties for entries that are media link entries and thus cannot carry any more structured data in the <content> element
· HTTP methods acting on bindings between resources (links) in addition to resources themselves
· Optimistic concurrency over HTTP, use of ETags and in general guaranteeing consistency when required
· Request batching (e.g. how does a client send a set of PUT/POST/DELETE operations to the server in a single go?)
d) Astoria design patterns that are not AtomPub format/protocol concepts or extensions:
· Astoria gives semantics to URLs and has a specific syntax to construct them
· How metadata that describes the structure of a service end points is exposed. This goes from being to find out entry points (e.g. collections in service documents) to having a way of discovering the structure of entries that contain structured data
e) How do we deal with aspects that AtomPub does not handle by design or just because it has not been needed so far?
· What to do with fields that may not have a backing value in the input source (e.g. updated, author).
· Replace versus merge semantics during updates
f) High-level client libraries. How high-level can we make clients so they can consume AtomPub-based Astoria services but still feel that they are working against regular objects and have general integration with the development environment?
There are probably more, but I think this is a good starting list.
Where do we go from here?
The folks in the AtomPub community understand this the best, so we’ll take our questions to the atom-syntax and atom-protocols lists to hear opinions there. We’ll probably track posts and comments in the Astoria blog as well so people that follow it can keep track of what’s going on in this space.
This post is part of the transparent design exercise in the Astoria Team. To understand how it works and how your feedback will be used please look at this post.