[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Creating Atom entries that depend on other entries
Yuri de Wit wrote:
> How should I design my Atom API so that I can
> create a "somethings" entry based on another
> collections' entry as a template? I.e. how can
> I POST to /somethings and have a new
> /something/1 created using /template/1 as its
There are a few ways of doing that but no matter what you choose, you will
be doing something that goes beyond what AtomPub specifies. I would do it by
having a "POST /template/1/new-entry" result in a new transient entry that
is formatted according to the template; the client edits the transient entry
with whatever it needs and then POSTs the entry to the /something/1
collection to create a permanent version of it.
> (2) Similarly, assuming that I have a hierarchy
> of resources (ownership relationship), e.g.
> parent and children, would you design a flat
> url space or an hierarchical one, or use both?
I suggest doing it the way that GData does it:
In particular, use hyperlinks between entries and collections instead of
relying on URL patterns. Every parent entry can expose a new collection that
can be used to create and list its children. Other feeds in the system can
aggregate the various feeds together to allow queries across multiple levels
of the hierarchy.