Interesting, not the way that URI Templates[1] work today, once you
substitute in you get a URI, not another URI Template, but I can
see the value in offering different optional standardized parameters
so clients can construct such subsets.
[1] http://bitworking.org/projects/URI-Templates/
-joe
--
Joe Gregorio http://bitworking.org
I initially shied away from hierarchy because of a fear of making
things too complexity, but if there's a need then it should be included.
> In my recent work at Etsy, I defined 3 types of resources:
> "attributes" (scalars), "objects" (relations, a list or dict of
> dissimilar scalars), and "collections" (groups of objects (allows
> POST) *or* groups of attributes (no POST); perhaps I should
> differentiate those more cleanly).
Is there any more documentation on this API? Can you give some
concrete examples of what you would use scalars, objects,
and collections for?
>> The only restriction on the representation of a collection is that it
>> should be an object. For example, let's look at some of the
>> representations in the Open Social specification and imagine what they
>> would look like in such a RESTful JSON collection. Here is a person
>> representation:
>>
>> {
>> "id" : "example.org:34KJDCSKJN2HHF0DW20394",
>> "name" : {"unstructured" : "Jane Doe"},
>> "gender" : {"displayvalue" : "女性", "key" : "FEMALE"}
>>
>> }
>
> Perhaps; I haven't found nested collections useful within a single
> representation yet. But certainly an object of simple scalars is very
> useful.
That example was just an example of a representation of a single member
of a collection, and something I copied directly out of the OpenSocial
specification. It could just as easily have been:
{ "foo": 2 }
or
{}
>>
>> {
When the member representations are small then there is a big performance
hit when the client has to make multiple round-trips, one to retrieve each
member. Maybe a standardized URI Template parameter to control
whether full representations are included in the collection representation?
>> There are a couple other features I'd like to add above and beyond
>> 'collections'; there should be 'config' and 'process' resources.
>>
>> The 'config' resources support GET and PUT, and represent
>> configuration options for the service. For example, ( actually this a
>> bad example since you should use AtomPub for a blog, but for the sake
>> of exposition let it slide ) in a blog you would use a collection to
>> manage the entries in the blog, one collection member per blog entry.
>> A 'config' resource associated with that blog would contain options
>> you could set, such as the users display name, their email address,
>> background color, etc.
>
> We have some examples of that, but I'm not sure they need to be
> elevated to the protocol level. They're just Yet Another Resource.
Yes, and I'm not sure much needs to be said about them, but I think
it would be useful to list them in a service document.
There's no tying, I don't see any need to make a connection between
AtomPub and a RESTful JSON protocol.
> You could already supply content in
> an Atom entry with a JSON mime type (or xml, or asn.1 or
> steganogriphied video clips or whatever). Presumably the focus here
> should be on things the protocol does rather than carries?
>
> If you relax the required entry elements to not include author and
> title, what more do you need the AtomPub doesn't have?
Atom is fixed, you can't relax the required entry elements.
>> One thing I would add to the normal 'collection' idiom is
>> the ability to retrieve a 'prototype' object that could be added to
>> the collection, as a way of indicating what the structure of the added
>> JSON object should have.
>
> Seems like most people do this now by looking at the feed and/or docs
> and guessing which things might be required. It would be nice to be
> able to identify or request a prototype entry, but building a json
> schema language just to support this seems fraught with peril, and
> obviously wouldn't work across content types.
I was actually thinking of a literal prototype object, not a JSON schema
of the object, but I suppose both ways have their merits, the former
being more amenable to view-source while the latter would be better
for machine processing.
>
>> The second addition to the 'collection' idiom
>> is a URI Template/OpenSearch based querying mechanism, which would
>> allow standardizing on paged/range requests.
>
> Definitely. If templates had a mime type (do they?), the collection
> entry in the service doc could indicate an association, eg
> rel="searchTemplate". If searchTemplates were actually entries in an
> associated collection, then it would even be possible to create/delete
> them via AtomPub which would be a really interesting feature.
URI Templates are just strings, but OpenSearch documents have media-types.
Depends on what needs to be included in the service description.
>> what would you like to see in a RESTful JSON specification?
>
> I'd rather see a handful of useful data-centric modifications to
> AtomPub than a new "RESTful JSON" specification.
I think AtomPub is great for documents and that it shouldn't
be loosened up to handle data.
If AtomPub works for you then you should use it, I'm not suggesting
otherwise. There are classes of applications for which AtomPub does not
work and I'm not myopic enough to suggest that AtomPub is the
one-true-RESTful-protocol.
> Atompub needs meta-publication, independently of this discussion. Meta-
> publishing should also be full life cycle - it should include full
> CRUD and not CD or CkRD. My colleague is putting together an I-D on
> this.
I'm looking forward to reading that I-D.
{
"some-property": ["string1", "string2"]
}
I realize that a literal prototype will only get you so far, but
is it far enough? I will also point out that JavaScript uses prototypes
instead of classes for objects, so I thought this might be
a little closer in spirit.
> What is so broken with Atom/AtomPub that we now have to start afresh?
> I didn't see a strong enough justification for this. Many others have
> said just as much. The community deserves a better explanation for
> what is "unfixably broken" about AtomPub.
Nothing is "unfixably broken". Atom syntax handles a nice set of use
cases, but not *every* use case, that's all. For some purposes, XML
and Atom are overkill. And AtomPub is closely tied to Atom syntax, as
it should be. Hence a parallel effort.
--
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures
Which purposes?
Bill
When you do not need the full generality of a document format, JSON is
simpler and terser over XML. When you do not need the metadata that
naturally characterizes documents, JSON Web Collections are simpler
and terser than Atom feeds.
There is nothing a car can do that a tank can't do except get more than 5 mpg.
Terser yes, but simpler is up for debate. The problem of course is
making an operational distinction between a document format and
something else; eg, I have no idea what you mean by a document.
Bill
... for the purposes of creating a specification, I didn't mean to be
snide. Let me put it this way - I can look at
protobufs/thrift/hessian/etch or similar custom interchange I do in work
and see immediately why they are useful and XML/Atom* isn't. For RESTful
JSON all I know is that 1) JSON ~= RPC++ is a potential problem, 2) we
don't have a sensible way to do partial updates, and 3) we want some
data to not depend on HTTP such as the version key.
Bill