From c62603ba735992b993f306284a52f9eab2cc112d Mon Sep 17 00:00:00 2001 From: Dustin Oprea Date: Sat, 28 Dec 2013 11:37:32 -0500 Subject: [PATCH] Added documentation for sorted listings. --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 4fed7fcf4..043d43edd 100644 --- a/README.md +++ b/README.md @@ -330,6 +330,38 @@ curl -X POST http://127.0.0.1:4001/v2/keys/queue -d value=Job2 } ``` +To enumerate the in-order keys as a sorted list, use the "sorted" parameter. + +```sh +curl -s -X GET 'http://127.0.0.1:4001/v2/keys/queue?recursive=true&sorted=true' | python -m json.tool +``` + +```json +{ + "action": "get", + "node": { + "createdIndex": 2, + "dir": true, + "key": "/queue", + "modifiedIndex": 2, + "nodes": [ + { + "createdIndex": 2, + "key": "/queue/2", + "modifiedIndex": 2, + "value": "Job1" + }, + { + "createdIndex": 3, + "key": "/queue/3", + "modifiedIndex": 3, + "value": "Job2" + } + ] + } +} +``` + [lockmod]: #lock