Hi,

I’m not sure if I have enough background to participate in the discussion,
so bear with me...

I think it wouldn’t be too hard to translate oak operations to an
HTTP-based API, if we just define some URLs as “special”, i.e. they don’t
represent the corresponding node in the repo but have special semantics.
For example, /sessions could represent sessions or transactions, which have
to be committed or discarded, or which are discarded automatically after
they expire.

Below are some example requests (responses are: status code - response
header; everything after # is a comment):

Req:        GET / # Get current revision
Resp:       302 - Location: /revisions/12345678-abcd-abcd-abcd-123456789abc

Req:        GET /sessions
Resp:       302 - Location: /sessions/12345678-abcd-abcd-abcd-123456789abc
# possibly several location headers if more than one session available for
the user (if we want to allow that)
            204 - # No sessions

Req:        POST /sessions # start a new session
Resp:       201 - Location: /sessions/12345678-abcd-abcd-abcd-123456789abc

Req:        PUT /sessions/12345678-abcd-abcd-abcd-123456789abc # Commit
session
Resp:       201 - Location: /revisions/12345678-abcd-abcd-abcd-123456789abc
# Success
            409 - # Merge conflict
            ...

Req:        GET /some/path # read a node (the node’s current value)

Req:        GET /sessions/12345678-abcd-abcd-abcd-123456789abc/some/path #
read the same node’s value at the time the session was created

Req:        GET /some/path/@prop # read a node’s property

Req:        PUT /some/path/@prop # create or replace property “prop” and
commit immediately

Req:        PUT
/sessions/12345678-abcd-abcd-abcd-123456789abc/some/path/@prop # create or
replace property “prop” within the session

Req:        DELETE /sessions/12345678-abcd-abcd-abcd-123456789abc # discard
a session

Req:        GET
/revisions/12345678-abcd-abcd-abcd-123456789abc/path/to/node # read a
revision

Req:        GET
/trees/12345678-abcd-abcd-abcd-123456789abc/path/to/root/of/subtree # read
a tree, output format can be json or anything, depending on Accept header.
Range header could limit output.

Authentication is done in the usual HTTP way.

WDYT?
    Axel

PS: The "special nodes" are probably better named
"/jcr:system/remote/{sessions,revisions,trees}"

Reply via email to