Files
sql/couchdb.http
2025-10-15 23:33:08 +02:00

64 lines
1.5 KiB
HTTP

@couchDB = http://couchdb.localhost
### Init
POST {{couchDB}}/_cluster_setup
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
Content-Type: application/json
{
"action": "enable_single_node",
"username": "{{$dotenv COUCHDB_USER}}",
"password": "{{$dotenv COUCHDB_PASSWORD}}",
"bind_address": "0.0.0.0",
"port": 5984
}
###
GET {{couchDB}}/_all_dbs
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
### Creates a new database.
PUT {{couchDB}}/db
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
### Creates a new document in the specified database, using the supplied JSON document structure.
POST {{couchDB}}/db
Accept: application/json
Content-Type: application/json
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
{
"servings": 4,
"subtitle": "Delicious with fresh bread",
"title": "Fish Stew"
}
###
GET {{couchDB}}/db/_all_docs
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
###
GET {{couchDB}}/db/2c2135ff744c3b98407572ed4f000cad
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
###
POST {{couchDB}}/db/_find
Authorization: Basic {{$dotenv COUCHDB_USER}}:{{$dotenv COUCHDB_PASSWORD}}
Accept: application/json
Content-Type: application/json
Content-Length: 168
Host: localhost:5984
{
"selector": {
"year": {"$gt": 2010}
},
"fields": ["_id", "_rev", "year", "title"],
"sort": [{"year": "asc"}],
"limit": 2,
"skip": 0,
"execution_stats": true
}