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

Commit 210ed98

Browse files
author
haydenyoung
committed
Document fetching database from swarm using address.
1 parent 2a02e4c commit 210ed98

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ curl -X GET http://localhost:3000/db/docstore/1
169169

170170
### POST /db/:dbname
171171

172-
Creates a new database and returns information about the newly created database.
172+
Creates a new database and returns information about the newly created database
173+
or opens an existing database with the same name.
173174

174175
Returns information about the database as a JSON object.
175176

@@ -192,6 +193,23 @@ POST param (this would apply to type docstore only):
192193
curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" -d "indexBy=name"
193194
```
194195

196+
To open an existing database, specify the address of the database. If the
197+
database does not exist locally it will be fetched from the swarm.
198+
199+
The address MUST be URL escaped.
200+
201+
```shell
202+
curl http://localhost:3000/db/zdpuAmnfJZ6UTssG5Ns3o8ALXZJXVx5eTLTxf7gfFzHxurbJq%2Fdocstore
203+
```
204+
205+
By default, OrbitDB will open the database if one already exists with the same
206+
name. To always overwrite the existing database with a new one, pass the
207+
overwrite flag:
208+
209+
```shell
210+
curl http://localhost:3000/db/docstore -d "create=true" -d "type=docstore" -d "overwrite=true"
211+
```
212+
195213
### POST|PUT /db/:dbname/iterator
196214

197215
Gets items from an eventlog or feed database :dbname.

0 commit comments

Comments
 (0)