Skip to content

Fetching Documents

isubiker edited this page Nov 30, 2011 · 17 revisions

Fetching Documents

Getting a specific document from the database via its URI can be accomplished by sending a GET request to the /store endpoint. If the document does not exist, a 404 is returned.

Request details

  • Endpoint: /store - For fetching XML, JSON, text and binary documents

  • Request type: GET

  • Parameters

    • uri - The URI of the document to be fetched
    • include (optional, multiple) - Can specify what parts of the document should be returned. Accepted values are:
      • content (default) - The original document stored at the URI. Note: For binary documents, when content is specified along with other include options the binary content is not returned in the response. Instead the searchable representation of the binary document is returned (see contentForBinary on the Inserting Documents page.)
      • collections - The collections that the document is in
      • properties - The properties on the document
      • permissions - The permissions on the document
      • quality - The quality set for the document
      • all - Returns all of the above items
    • extractPath (optional) - Either a JSON path or a simplified XPath (depending on the content type) that can be used to limit what part(s) of the document are returned
    • applyTransform (optional) - Applies a transform to the content. If an extractPath is also specified, the transform is handed the content specified by the extractPath.
    • txid (optional) - A pre-existing transaction ID in which the fetch should be performed. See creating transactions for more info. Note: If running in a clustered environment, document fetch requests must be issued to the same host that created the ticket.
  • Returns

    • On success a 200 is returned and the response body will include the requested content
    • If the document at the URI doesn't exist, a 404 is returned

Examples

  • /store?uri=/foo/bar.xml - Will return the XML document in the database with a URI of "/foo/bar.xml"
  • /store?uri=/foo/bar.json - Will return the JSON document in the database with a URI of "/foo/bar.json"

Discussion

What if include=bogus is specified?

What if extractPath is malformed?

What if the named applyTransform doesn't exist?

Should include an example where include=all.

Clone this wiki locally