You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2010/02/28 19:22:04 UTC
[Couchdb Wiki] Update of "HTTP_database_API" by SebastianCohnen
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "HTTP_database_API" page has been changed by SebastianCohnen.
The comment on this change is: Added TOC; little bit of restructuring & cleanup.
http://wiki.apache.org/couchdb/HTTP_database_API?action=diff&rev1=11&rev2=12
--------------------------------------------------
+ = HTTP Database API =
+ <<TableOfContents(3)>>
+
An introduction to the CouchDB HTTP Database API.
== Naming and Addressing ==
@@ -28, +31 @@
All database files are stored in a single directory on the file system. If your database includes a ''/'' CouchDB will create a sub-directory structure in the database directory. That is, a database named ''his/her'', the database file will be available at ''$dbdir/his/her.couch''. This is useful when you have a large number of databases and your file system does not like that.
+ == Working with Databases ==
- == List Databases ==
+ === List Databases ===
To get a list of databases on a CouchDB server, use the ''/_all_dbs'' URI:
@@ -50, +54 @@
["somedatabase", "anotherdatabase"]
}}}
- == PUT (Create New Database) ==
+ === PUT (Create New Database) ===
To create a new empty database, perform a PUT operation at the database URL. Currently the content of the actual PUT is ignored by the webserver.
@@ -74, +78 @@
{"ok": true}
}}}
- == DELETE ==
+ === DELETE ===
To delete a database, perform a DELETE operation at the database location.
@@ -98, +102 @@
{"ok": true}
}}}
- == Database Information ==
+ === Database Information ===
To get information about a particular database, perform a GET operation on the database, e.g.:
@@ -112, +116 @@
{"db_name": "dj", "doc_count":5, "doc_del_count":0, "update_seq":13, "compact_running":false, "disk_size":16845}
}}}
- == Changes ==
+ === Changes ===
A list of changes made to documents in the database, in the order they were made, can be obtained from the database's ''_changes'' resource.
@@ -154, +158 @@
"last_seq":5}
}}}
- === Long-Polling (Efficient Polling) Feed ===
+ ==== Long-Polling (Efficient Polling) Feed ====
The ''longpoll'' feed (probably most useful used from a browser) is a more efficient form of polling that waits for a change to occur before the response is sent. ''longpoll'' avoids the need to frequently poll CouchDB to discover nothing has changed!
@@ -162, +166 @@
A ''timeout'' limits the maximum length of time the connection is open. If there are no changes before the timeout expires the response's ''results'' will be an empty list.
- === Continuous (Non-Polling) Feed ===
+ ==== Continuous (Non-Polling) Feed ====
Polling the CouchDB server is not a good thing to do. Setting up new HTTP connections just to tell the client that nothing's happened puts unnecessary strain on CouchDB.