couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "HTTP Document API" by WoutMertens
Date Mon, 09 Mar 2009 21:25:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by WoutMertens:
http://wiki.apache.org/couchdb/HTTP_Document_API

The comment on the change is:
explained about / in DocID and attachments

------------------------------------------------------------------------------
  
  === Valid Document Ids ===
  
+ You can have '''/''' as part of the DocID but if you refer to a document in a URL you must
always encode it as '''%2F'''. One special case is '''_design/''' documents, those accept
either '''/''' or '''%2F''' for the '''/''' after ''_design'', although '''/''' is preferred
and %2F is still needed for the rest of the DocID.
+ 
    Q: What's the rule on a valid document id? The examples suggest it's restricted to ''[a-zA-Z0-9_]''?
What about multi-byte UTF-8 characters? Any other non alphanums other than ''_''?
  
    A: There is no restriction yet on document ids at the database level. However, I haven't
tested what happens when you try to use multibyte in the URL. It could be it "just works",
but most likely there is a multi-byte char escaping/encoding/decoding step that needs to be
done somewhere. For now, I'd just stick with valid URI characters and nothing "special".
@@ -24, +26 @@

  
  == JSON ==
  
- A CouchDB document is simply a JSON object. (Along with metadata revision info if ''?full=true''
is in the URL query arguments.
+ A CouchDB document is simply a JSON object. (Along with metadata revision info if ''?full=true''
is in the URL query arguments)
  
  This is an example document:
  
@@ -472, +474 @@

  == Attachments ==
  
  Documents can have attachments just like email. There are two ways to use attachments. The
first one is inline with your document and it described first. The second one is a separate
REST API for attachments that is described a little further down.
+ 
+ A note on attachment names: Attachments may have embedded '''/''' characters that are sent
unescaped to CouchDB. You can use this to provide a subtree of attachments under a document.
A DocID must have any '''/''' escaped as '''%2F'''. So if you have document ''a/b/c'' with
an attachment ''d/e/f.txt'', you would be able to access it at http://couchdb/db/a%2fb%2fc/d/e/f.txt
.
  
  === Inline Attachments ===
  On creation, attachments go into a special ''_attachments'' attribute of the document. They
are encoded in a JSON structure that holds the name, the content_type and the base64 encoded
data of an attachment. A document can have any number of attachments.

Mime
View raw message