Differences between revisions 9 and 10
Revision 9 as of 2012-04-16 12:04:32
Size: 2129
Editor: 74-80-56-56
Comment: Correct the UUID algorithm label
Revision 10 as of 2018-04-13 05:41:19
Size: 0
Editor: JoanTouzet
Comment: migrated
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:

= HTTP GET _uuids =

||'''Query args'''||count='''n'''||How many UUIDs to generate ''(optional, default '''1''')''||
||'''Request body'''||<-2>None||
||'''Response body'''||<-2>JSON object containing a list of generated UUIDs||

== Description ==

Returns a list of generated UUIDs. CouchDB generated UUIDs are of all lowercase strings of 32 characters; they do not conform to the UUID standard. They are obtained from through this API, and automatically used when using POST to add articles to a database, but are not otherwise used anywhere. There is no need to use the UUIDs generated by CouchDB for anything. The generated UUIDs are not checked for uniqueness. In the (very unlikely) case of where there is a duplicate, this is expected to be resolved when documents are inserted in to the database.

CouchDB attempts to make sure that the results of this request are never cached by giving several cache-inhibiting headers in the response.

CouchDB has three different UUID generation algorithms:

 * {{{random}}}: 32 hex characters generated completely at random.

 * {{{sequential}}}: 26 hex character random prefix, followed by 6 hex characters of sequence, which is incremented by random amounts. When the 6 character sequence overflows, a new random prefix is chosen. There are no guarantees of ordering, but most inserted documents will be sequentially ordered. This improves insert speed as most B-tree edits do not happen randomly. Also, if the documents are likely to be accessed sequentially, this improves access speeds.

 * {{{utc_random}}}: First 14 hex characters are microseconds since Jan 1, 1970 (Unix epoch), followed by 18 random hex characters.

The UUID generation algorithm is specified in CouchDB configuration as {{{uuids/algorithm}}}.

== Example ==
GET /_uuids HTTP/1.1
HTTP/1.1 200 OK
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
ETag: "EWNHGXU29MRN49ZE792Z9Q466"
Cache-Control: must-revalidate, no-cache