|
18 | 18 | - [Modulus Query](#modulus-query) |
19 | 19 | - [Range Query](#range-query) |
20 | 20 | - [GET /db/:dbname/:item](#get-dbdbnameitem) |
21 | | - - [POST /db/:dbname](#post-dbdbname) |
22 | 21 | - [GET /db/:dbname/iterator](#get-dbdbnameiterator) |
23 | 22 | - [GET /db/:dbname/index](#get-dbdbnameindex) |
| 23 | + - [GET /identity](#get-identity) |
| 24 | + - [POST /db/:dbname](#post-dbdbname) |
| 25 | + - [POST|PUT /db/:dbname/add](#post-put-dbdbnameadd) |
| 26 | + - [POST|PUT /db/:dbname/put](#post-put-dbdbnameput) |
| 27 | + - [POST|PUT /db/:dbname/inc](#post-put-dbdbnameinc) |
| 28 | + - [POST|PUT /db/:dbname/inc/:val](#post-put-dbdbnameincval) |
| 29 | + - [DELETE /db/:dbname](#delete-dbdbname) |
| 30 | + - [DELETE /db/:dbname/:item](#delete-dbdbnameitem) |
| 31 | +- [Contribute](#contribute) |
| 32 | +- [License](#license) |
24 | 33 |
|
25 | 34 | ## Install |
26 | 35 |
|
@@ -185,49 +194,6 @@ curl -X GET http://localhost:3000/db/docstore/1 |
185 | 194 | [{"_id":1, "value": "test"}] |
186 | 195 | ``` |
187 | 196 |
|
188 | | -### POST /db/:dbname |
189 | | - |
190 | | -Creates a new database and returns information about the newly created database |
191 | | -or opens an existing database with the same name. |
192 | | - |
193 | | -Returns information about the database as a JSON object. |
194 | | - |
195 | | -The OrbitDB options ```create=true``` and ```type=eventlog|feed|docstore|keyvalue|counter``` |
196 | | -must be sent with the POST otherwise an error is thrown. |
197 | | - |
198 | | -```shell |
199 | | -curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" |
200 | | -``` |
201 | | - |
202 | | -```json |
203 | | -{"address":{"root":"zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq","path":"docstore"},"dbname":"docstore","id":"/orbitdb/zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq/docstore","options":{"create":"true","indexBy":"_id","localOnly":false,"maxHistory":-1,"overwrite":true,"replicate":true},"type":"docstore"} |
204 | | -``` |
205 | | - |
206 | | -Additional OrbitDB-specific flags can also be passed. For example, if the index |
207 | | -field must be changed then the indexBy flag can be specified as an additional |
208 | | -POST param (this would apply to type docstore only): |
209 | | - |
210 | | -```shell |
211 | | -curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" -d "indexBy=name" |
212 | | -``` |
213 | | - |
214 | | -To open an existing database, specify the address of the database. If the |
215 | | -database does not exist locally it will be fetched from the swarm. |
216 | | - |
217 | | -The address MUST be URL escaped. |
218 | | - |
219 | | -```shell |
220 | | -curl -X POST http://localhost:3000/db/zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq%2Fdocstore |
221 | | -``` |
222 | | - |
223 | | -By default, OrbitDB will open the database if one already exists with the same |
224 | | -name. To always overwrite the existing database with a new one, pass the |
225 | | -overwrite flag: |
226 | | - |
227 | | -```shell |
228 | | -curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" -d "overwrite=true" |
229 | | -``` |
230 | | - |
231 | 197 | ### GET /db/:dbname/iterator |
232 | 198 |
|
233 | 199 | Gets items from an eventlog or feed database :dbname. |
@@ -292,6 +258,70 @@ The counter data store returns information about the current counter value: |
292 | 258 | {"id":"04e6de9dd0e8d0069bcc6d8f3ef11cefe63bba6129c32f2cd422a0394814bc6723b26eb62731ee466020b0394d01dd08e4a5123eaad45e4d0840fd796652a22e42","counters":{"04e6de9dd0e8d0069bcc6d8f3ef11cefe63bba6129c32f2cd422a0394814bc6723b26eb62731ee466020b0394d01dd08e4a5123eaad45e4d0840fd796652a22e42":15}} |
293 | 259 | ``` |
294 | 260 |
|
| 261 | +### GET /identity |
| 262 | + |
| 263 | +Gets the identity information. |
| 264 | + |
| 265 | +Returns identity as a JSON object. |
| 266 | + |
| 267 | +```shell |
| 268 | +curl -X GET http://localhost:3000/identity |
| 269 | +``` |
| 270 | + |
| 271 | +```json |
| 272 | +{"id":"03fc293ea95bdb5dea71d5d21cbbae2a57f2d2002c9966f0d5c7b0bda232d5934d","publicKey":"048161d9685991dc87f3e049aa04b1da461fdc5f8a280ed6234fa41c0f9bc98a1ce91f07494584a45b97160ac818e100a6b27777e0b1b09e6ba4795dcc797a6d8b","signatures":{"id":"3045022100e40ab2dcc83dde17c939d5515ce322e7f81bf47536ab342582db8c35f28d2a720220228e418cc3d2f3e0004d5f4292c0d2cf7975c93073e0cc831f0cb849e4ac920a","publicKey":"3045022100ad18ba66006e19e2952eabc9ffb532dd69d60593f90448a05d6f4903c2931e3502204009975030b839522c668cd693d357bf1f3d0423d604a6bc10645425a0a3dd1b"},"type":"orbitdb"} |
| 273 | +``` |
| 274 | + |
| 275 | +### POST /db/:dbname |
| 276 | + |
| 277 | +Creates a new database and returns information about the newly created database |
| 278 | +or opens an existing database with the same name. |
| 279 | + |
| 280 | +Returns information about the database as a JSON object. |
| 281 | + |
| 282 | +The OrbitDB options ```create=true``` and ```type=eventlog|feed|docstore|keyvalue|counter``` |
| 283 | +must be sent with the POST otherwise an error is thrown. |
| 284 | + |
| 285 | +```shell |
| 286 | +curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" |
| 287 | +``` |
| 288 | + |
| 289 | +```json |
| 290 | +{"address":{"root":"zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq","path":"docstore"},"dbname":"docstore","id":"/orbitdb/zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq/docstore","options":{"create":"true","indexBy":"_id","localOnly":false,"maxHistory":-1,"overwrite":true,"replicate":true},"type":"docstore"} |
| 291 | +``` |
| 292 | + |
| 293 | +Additional OrbitDB-specific flags can also be passed. For example, if the index |
| 294 | +field must be changed then the indexBy flag can be specified as an additional |
| 295 | +POST param (this would apply to type docstore only): |
| 296 | + |
| 297 | +```shell |
| 298 | +curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" -d "indexBy=name" |
| 299 | +``` |
| 300 | + |
| 301 | +Parameters can also be passed as JSON. This is useful if additional parameters |
| 302 | +such as accessController need to be specified: |
| 303 | + |
| 304 | +```shell |
| 305 | +curl -H "Content-Type: application/json" --data '{"create":"true","type":"feed","accessController":{"type": "orbitdb","write": ["1234"]}}' |
| 306 | +``` |
| 307 | + |
| 308 | +To open an existing database, specify the address of the database. If the |
| 309 | +database does not exist locally it will be fetched from the swarm. |
| 310 | + |
| 311 | +The address MUST be URL escaped. |
| 312 | + |
| 313 | +```shell |
| 314 | +curl -X POST http://localhost:3000/db/zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq%2Fdocstore |
| 315 | +``` |
| 316 | + |
| 317 | +By default, OrbitDB will open the database if one already exists with the same |
| 318 | +name. To always overwrite the existing database with a new one, pass the |
| 319 | +overwrite flag: |
| 320 | + |
| 321 | +```shell |
| 322 | +curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" -d "overwrite=true" |
| 323 | +``` |
| 324 | + |
295 | 325 | ### POST|PUT /db/:dbname/add |
296 | 326 |
|
297 | 327 | Adds a new entry to the eventlog or feed database :dbname. |
|
0 commit comments