Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 470ac36

Browse files
author
haydenyoung
committed
Documentation for new index endpoint.
1 parent de93c11 commit 470ac36

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- [GET /db/:dbname/:item](#get-dbdbnameitem)
2121
- [POST /db/:dbname](#post-dbdbname)
2222
- [GET /db/:dbname/iterator](#get-dbdbnameiterator)
23-
- [GET /db/:dbname/all](#get-dbdbnameall)
23+
- [GET /db/:dbname/index](#get-dbdbnameindex)
2424

2525
## Install
2626

@@ -257,20 +257,39 @@ curl -X GET http://localhost:3000/db/feed/iterator -d 'limit=-1'
257257
See [OrbitDB's Iterator API](https://github.com/orbitdb/orbit-db/blob/master/API.md#iteratoroptions-1)
258258
for more information.
259259

260-
### GET /db/:dbname/all
260+
### GET /db/:dbname/index
261261

262-
Gets all items from a keyvalue database :dbname.
262+
Gets information about the data stored in :dbname.
263263

264-
Returns all items from a keyvalue store as a JSON object.
264+
Returns information about the data stored as a JSON object.
265265

266-
Can only be used on keyvalue.
266+
For the data store keyvalue all records are returned:
267267

268268
```shell
269-
curl -X GET http://localhost:3000/db/all
269+
curl -X GET http://localhost:3000/keyvalue/index
270270
```
271271

272272
```json
273-
{"Key1":{"name":"Value1"},"Key2":{"name":"Value2"},"projects":"\{["orbitdb","ipfs"]}}
273+
{"Key":{"name1":"Value1"},"Key2":{"name":"Value2"}}
274+
```
275+
276+
Docstore and feed return all records as well as iterators, signature hashes and
277+
other information about the stored data:
278+
279+
```json
280+
{"1":{"cid":"zdpuB1sqnXKwgAtJT7vqtrRUsyr4XUZyhume9uJgrrwZmyegu","id":"/orbitdb/zdpuAzpw8yuuMEuffMFcgXafsAye9GqBPwTjmiJijHz3akFhx/docstore","payload":{"op":"PUT","key":1,"value":{"_id":1,"name":"1"}},"next":[],"v":1,"clock":...}}
281+
```
282+
283+
The eventlog returns the hash of the last stored item:
284+
285+
```json
286+
{"id":"/orbitdb/zdpuB1r3rfya65UUjQu6GsBXEmp5gmjvMwRGwkxd4ySwYnBSK/eventlog","heads":["zdpuAu7eTsdWoQ76CdWCbjcsGV3s6duYyUujaHQiGCAZPLWMb"]}
287+
```
288+
289+
The counter data store returns information about the current counter value:
290+
291+
```json
292+
{"id":"04e6de9dd0e8d0069bcc6d8f3ef11cefe63bba6129c32f2cd422a0394814bc6723b26eb62731ee466020b0394d01dd08e4a5123eaad45e4d0840fd796652a22e42","counters":{"04e6de9dd0e8d0069bcc6d8f3ef11cefe63bba6129c32f2cd422a0394814bc6723b26eb62731ee466020b0394d01dd08e4a5123eaad45e4d0840fd796652a22e42":15}}
274293
```
275294

276295
### POST|PUT /db/:dbname/add

0 commit comments

Comments
 (0)