You will add a new document to the Orders
database by creating a POST
request using the RESTClient tool. As RavenDB will generate the ID for the new document, we will not specify any ID for the document. Once the document is added to the database on the server, we will open the Management Studio and verify that the document has been correctly inserted into the database and we will analyze the server response:
Launch the RESTClient tool.
Click on the Method tab and select the POST HTTP method.
In the HTTP Request section, enter this URL:
http://localhost:8080/databases/orders/docs
.Click on the Body tab and select String body from the drop-down list and enter the following JSON snippet:
{ "CustomerId": "B66689", "Item": "USB Key", "OrderDate": "1/7/2012", "UnitCost": 28.5, "Units": 5 }
Click on the Header tab and enter
Raven-Entity-Name
in the Key textbox andOrders
in the Value textbox and then click on the green plus sign to add this metadata...