curl -X GET http:
//127
.0.0.1:5984
{
"couchdb"
:
"Welcome"
,
"uuid"
:
"a853c053a5a54a4d3ccbaad0d9ffd3b0"
,
"version"
:
"1.6.1"
,
"vendor"
:{
"version"
:
"1.6.1"
,
"name"
:
"The Apache Software Foundation"
}}
curl -X PUT http:
//127
.0.0.1:5984
/demo
{
"error"
:
"unauthorized"
,
"reason"
:
"You are not a server admin."
}
curl -X PUT http:
//username
:password@127.0.0.1:5984
/demo
{
"ok"
:
true
}
curl -X GET http:
//127
.0.0.1:5984
/_all_dbs
[
"_replicator"
,
"_users"
,
"demo"
]
curl -X GET http:
//127
.0.0.1:5984
/demo
{
"db_name"
:
"demo"
,
"doc_count"
:0,
"doc_del_count"
:0,
"update_seq"
:0,
"purge_seq"
:0,
"compact_running"
:
false
,
"disk_size"
:79,
"data_size"
:0,
"instance_start_time"
:
"1452000207199340"
,
"disk_format_version"
:6,
"committed_update_seq"
:0}
curl -H
"Content-Type:application/json"
-X POST http:
//127
.0.0.1:5984
/demo
-d {\"name\":\"fooly\"}
{
"ok"
:
true
,
"id"
:
"3ebb59dd78ff448f283f48817800321c"
,
"rev"
:
"1-0e4ea534f2c1e7f05e21804b5f2f7a71"
}
curl -X GET http:
//127
.0.0.1:5984
/demo/_all_docs
{
"total_rows"
:1,
"offset"
:0,
"rows"
:[
{
"id"
:
"3ebb59dd78ff448f283f48817800321c"
,
"key"
:
"3ebb59dd78ff448f283f48817800321c"
,
"value"
:{
"rev"
:
"1-0e4ea534f2c1e7f05e21804b5f2f7a71"
}}
]}
curl -X GET http:
//127
.0.0.1:5984
/_uuids
{
"uuids"
:[
"3ebb59dd78ff448f283f4881780033c0"
]}
curl -H
"Content-Type:application/json"
-X PUT http:
//127
.0.0.1:5984
/demo/3ebb59dd78ff448f283f4881780033c0
-d {\"name\":\"momo314\"}
{
"ok"
:
true
,
"id"
:
"3ebb59dd78ff448f283f4881780033c0"
,
"rev"
:
"1-eb393d36ac1ad38ada8361d94fc5d0b6"
}
curl -H
"Content-Type:application/json"
-X PUT http:
//127
.0.0.1:5984
/demo/3ebb59dd78ff448f283f4881780033c0
-d {\"name\":\"momo314\",\"age\":18}
{
"error"
:
"conflict"
,
"reason"
:
"Document update conflict."
}
curl -H
"Content-Type:application/json"
-X PUT http:
//127
.0.0.1:5984
/demo/3ebb59dd78ff448f283f4881780033c0
-d {\"_rev\":\"1-eb393d36ac1ad38ada8361d94fc5d0b6\",\"name\":\"momo314\",\"age\":18}
{
"ok"
:
true
,
"id"
:
"3ebb59dd78ff448f283f4881780033c0"
,
"rev"
:
"2-5d081e17588c03c27340035e420edecd"
}
curl -X GET http:
//127
.0.0.1:5984
/demo/3ebb59dd78ff448f283f4881780033c0
{
"_id"
:
"3ebb59dd78ff448f283f4881780033c0"
,
"_rev"
:
"2-5d081e17588c03c27340035e420edecd"
,
"name"
:
"momo314"
,
"age"
:18}
curl -X DELETE http:
//username
:password@127.0.0.1:5984
/demo/3ebb59dd78ff448f283f4881780033c0
?rev=2-5d081e17588c03c27340035e420edecd
{
"ok"
:
true
,
"id"
:
"3ebb59dd78ff448f283f4881780033c0"
,
"rev"
:
"2-5d081e17588c03c27340035e420edecd"
}
curl -X GET http:
//127
.0.0.1:5984
/demo/_all_docs
{
"total_rows"
:1,
"offset"
:0,
"rows"
:[
{
"id"
:
"3ebb59dd78ff448f283f48817800321c"
,
"key"
:
"3ebb59dd78ff448f283f48817800321c"
,
"value"
:{
"rev"
:
"1-0e4ea534f2c1e7f05e21804b5f2f7a71"
}}
]}
curl -X DELETE http:
//127
.0.0.1:5984
/demo
{
"error"
:
"unauthorized"
,
"reason"
:
"You are not a server admin."
}
curl -X DELETE http:
//username
:password@127.0.0.1:5984
/demo
{
"ok"
:
true
}
curl -X GET http:
//127
.0.0.1:5984
/_all_dbs
[
"_replicator"
,
"_users"
]