'curl'에 해당되는 글 1건
[CouchDB] HTTP database API
Posted at 2009/07/09 18:38// Posted in 나만의 작업/DataBase
CouchDB의 Reference중 HTTP database API
제 나름의 정리이기에 생략된 것도 있습니다.
실행은 curl을 통해서 주로 하였습니다.
실행은 curl을 통해서 주로 하였습니다.
Naming and Addressing
database 이름은 모두 소문자 a-z, 숫자 0-9, _$()+-/ 문자로 이뤄져야 하고 slash(/)로 끝나야한다.
http://couchserver/databasename/
http://couchserver/another/databasename/
http://couchserver/another/database_name(1)/
주의! 대문자는 database 이름에 포함되어서는 안된다.
http://couchserver/DBNAME/ (invalid)
http://couchserver/DatabaseName/ (invalid)
http://couchserver/databaseName/ (invalid)
URL에서 DB이름에 slash(/)를 넣기 위해선 escape 처리를 해야한다.
DB이름이 "his/her" 이면 url을 이렇게 써서 보내야 한다.
http://localhost:5984/his%2Fher
List Databases
CouchDB server에 있는 모든 database들의 리스트 조회 /_all_dbs
~] curl http://localhost:5984/_all_dbs
HTTP/1.1 200 OK
Date: Thu, 17 Aug 2006 05:39:28 +0000GMT
Content-Length: 37
Content-Type: application/json
Connection: close
["somedatabase", "anotherdatabase"]
PUT (Create New Database)
위에 slash있는 Database이름을 만들어 보면
~]curl -X PUT http://localhost:5984/buri/test/
{"error":"invalid_json","reason":"undefined"}
escape처리해서 보내야 하므로~
~]curl -i -X PUT http://localhost:5984/buri%2Ftest/
HTTP/1.1 201 Created
Server: CouchDB/0.9.0 (Erlang OTP/R13B)
Date: Sat, 04 Jul 2009 10:56:20 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 12
Cache-Control: must-revalidate
{"ok":true}
이렇게 PUT 메소드를 실행하여 새로운 database를 만들었다!
성공하면 201 이미 존재한다면 412 HTTP status를 응답받는다.
DELETE
database를 지우고 싶으면 DELETE method를 이용하면 된다.
~]curl -X DELETE http://localhost:5984/buri%2Ftest
{"ok":true}
성공하면 200, 존재하지 않는다면 404 error HTTP status를 응답받는다.
Database Information
~]curl http://localhost:5984/buri
{"db_name":"buri","doc_count":2,"doc_del_count":2,"update_seq":6,"purge_seq":0,"compact_running":false,
"disk_size":16361,"instance_start_time":"1246416252648676"}
'나만의 작업 > DataBase' 카테고리의 다른 글
| [CouchDB] Apache CouchDB 0.10.0 이 나왔답니다. (2) | 2009/10/14 |
|---|---|
| [CouchDB] HTTP view API (0) | 2009/09/29 |
| [CouchDB] HTTP Document API (0) | 2009/07/14 |
| [CouchDB] Compaction (0) | 2009/07/13 |
| [CouchDB] HTTP database API (2) | 2009/07/09 |
| [CouchDB] API Cheatsheet (0) | 2009/07/09 |
| [CouchDB] 초간단 Mac에서 CouchDB 실행하기 (0) | 2009/07/07 |
| [CouchDB] 1. CouchDB가 뭐지? (2) | 2009/07/07 |
| [오라클] 초성검색 (2) | 2009/04/28 |



지금 비가 제법 내리고 있는거 같더라구여. 덕분에 차분한 밤을 보내고 있습니다 ^.~
주말내내 비가 정말 많이 내렸던 듯..
덕분에 저도 밤에 차분히 보냈답니다..ㅋㅋ