I spent some time looking at what others are doing for inspiration. I kind of like the Riak/Basho approach with multipart-chunks and the approach of explictely creating a resource for the query that can be navigated (either via pages or first,next,[prev,last] links) and expires (and could be reconstructed).
Cheers Michael Good discussion: http://stackoverflow.com/questions/924472/paging-in-a-rest-collection CouchDB: http://wiki.apache.org/couchdb/HTTP_Document_API startKey + limit, endKey + limit, sorting, insert/update order Mongooese: [cursor-id]+batch_size OrientDB: .../[limit] Sones: no real rest API, but a SQL on top of the graph: http://developers.sones.de/documentation/graph-query-language/select/ with limit, offset, but also depth (for graph) HBase explcitly creates scanners, which can be then access with next operations, and expire after no activity for a certain timeout riak: http://wiki.basho.com/REST-API.html client-id header for client identification -> sticky? optional query parameters for including properties, and if to stream the data keys=[true,false,stream] If “keys=stream”, the response will be transferred using chunked-encoding, where each chunk is a JSON object. The first chunk will contain the “props” entry (if props was not set to false). Subsequent chunks will contain individual JSON objects with the “keys” entry containing a sublist of the total keyset (some sublists may be empty). riak seems to support partial json, non closed elements: -d '{"props":{"n_val":5' returns multiple responses in one go, Content-Type: multipart/mixed; boundary=YinLMzyUR9feB17okMytgKsylvh --YinLMzyUR9feB17okMytgKsylvh Content-Type: application/x-www-form-urlencoded Link: </riak/test>; rel="up" Etag: 16vic4eU9ny46o4KPiDz1f Last-Modified: Wed, 10 Mar 2010 18:01:06 GMT {"bar":"baz"} (this block can be repeated n times) --YinLMzyUR9feB17okMytgKsylvh-- * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 Query results: Content-Type – always multipart/mixed, with a boundary specified Understanding the response body The response body will always be multipart/mixed, with each chunk representing a single phase of the link-walking query. Each phase will also be encoded in multipart/mixed, with each chunk representing a single object that was found. If no objects were found or “keep” was not set on the phase, no chunks will be present in that phase. Objects inside phase results will include Location headers that can be used to determine bucket and key. In fact, you can treat each object-chunk similarly to a complete response from read object, without the status code. < HTTP/1.1 200 OK < Server: MochiWeb/1.1 WebMachine/1.6 (eat around the stinger) < Expires: Wed, 10 Mar 2010 20:24:49 GMT < Date: Wed, 10 Mar 2010 20:14:49 GMT < Content-Type: multipart/mixed; boundary=JZi8W8pB0Z3nO3odw11GUB4LQCN < Content-Length: 970 < --JZi8W8pB0Z3nO3odw11GUB4LQCN Content-Type: multipart/mixed; boundary=OjZ8Km9J5vbsmxtcn1p48J91cJP --OjZ8Km9J5vbsmxtcn1p48J91cJP Content-Type: application/json Etag: 3pvmY35coyWPxh8mh4uBQC Last-Modified: Wed, 10 Mar 2010 20:14:13 GMT {"riak":"CAP"} --OjZ8Km9J5vbsmxtcn1p48J91cJP-- --JZi8W8pB0Z3nO3odw11GUB4LQCN Content-Type: multipart/mixed; boundary=RJKFlAs9PrdBNfd74HANycvbA8C --RJKFlAs9PrdBNfd74HANycvbA8C Location: /riak/test/doc2 Content-Type: application/json Etag: 6dQBm9oYA1mxRSH0e96l5W Last-Modified: Wed, 10 Mar 2010 18:11:41 GMT {"foo":"bar"} --RJKFlAs9PrdBNfd74HANycvbA8C-- --JZi8W8pB0Z3nO3odw11GUB4LQCN-- * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 Riak - MapReduce: Optional query parameters: * chunked – when set to true, results will be returned one at a time in multipart/mixed format using chunked-encoding. Important headers: * Content-Type – application/json when chunked is not true, otherwise multipart/mixed with application/json parts Other interesting endpoints: /ping, /stats _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user