CRUD

Yep that's Create, Read, Update, and Delete. Corona uses the term Insert instead of Create but that doesn't keep us from saying CRUD for fun. Corona includes a simple API for CRUD.

To insert a document, send a PUT request to the /store endpoint with the document URI as a parameter. A file extension of .xml, .json, or .txt indicates its type, or you can override with a contentType parameter. For example, to store a JSON document with URI /afternoon-drink.json:

If you haven't seen the curl tool before, it's a popular command line http client, that is ideal for playing with REST apis. If you don't have a copy, look here.

 

To get the document back:

To update the document, send a POST request:

And to delete the document, send a DELETE request:

Corona provides additional functionality related to CRUD, including

  • Retrieving pieces of documents via simplified XPath or JSON Path
  • Converting documents during retrieval (for example, to HTML on the way out)
  • Managing document metadata (collections, permissions, properties, quality)
  • Retrieving (or deleting) documents based on a search

Much of this is covered in the API documentation for the /store and endpoint on the Corona wiki at

Basic Concepts

Search APIs

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.