RavenDB: Learn to Use the HTTP API

If you haven't spent some time with RavenDB's HTTP API, it would definitely be worth your while. Learning to query Raven directly from a URL will open a lot of doors to figuring out what is going on inside the database. Head over to the Chrome Web Store and download the JSON Formatter extension. It automatically formats JSON responses in the browser, making them readable. Otherwise, you will just get a wall of text that is difficult to parse visually.

You might begin by making a simple request like:


Which returns a document that looks like this:

    "LastDocEtag": "00000000-0000-0100-0000-000000000002",
    "LastAttachmentEtag": "00000000-0000-0000-0000-000000000000",
    "CountOfIndexes": 1,
    "ApproximateTaskCount": 0,
    "CountOfDocuments": 1,
    "StaleIndexes": [],
    "CurrentNumberOfItemsToIndexInSingleBatch": 512,
    "CurrentNumberOfItemsToReduceInSingleBatch": 256,
    "Indexes": [{
        "Name": "Raven/DocumentsByEntityName",
        "IndexingAttempts": 1,
        "IndexingSuccesses": 1,
        "IndexingErrors": 0,
        "LastIndexedEtag": "00000000-0000-0100-0000-000000000002",
        "LastIndexedTimestamp": "2012-08-09T01:11:55.9200000",
        "TouchCount": 1,
        "ReduceIndexingAttempts": null,
        "ReduceIndexingSuccesses": null,
        "ReduceIndexingErrors": null,
        "LastReducedEtag": null,
        "LastReducedTimestamp": null
    "Errors": [],
    "Triggers": [
    // ... lots of triggers!
    "Extensions": [
    // ... lots of extensions!

That returns a document that contains some basic information about the server, such as the number of documents, recent Etags, and lists of indexes and triggers.

You can also query what tenant databases exist:


    "Settings": {
        "Raven/DataDir": "~\\Tenants\\Widgets"
    "@metadata": {
        "@id": "Raven/Databases/Widgets",
        "Last-Modified": "2012-08-09T01:11:55.9200000",
        "@etag": "00000000-0000-0100-0000-000000000002",
        "Non-Authoritative-Information": false

If you're using multi tenancy (and you should be), you can query the stats of a specific database. Assume my instance of RavenDB has a tenant database called "Widgets":


To get some data out of RavenDB, you can ask for the most recent documents:


Then, to get a specific document, add on the document ID (in this case we'll use "foos/1"):


You can also query documents based on what their ID starts with:


This is particularly helpful when you're working with Replication, since you can look for all replication documents very easily:


This query might return a bunch of documents, like ones with these IDs: