Getting Design Doc Information

  • reference
    To retrieve a design document, use the GET /bucket/_design/[ddoc-name] HTTP method and URI on the 8092 port.


    To obtain an existing design document from a bucket, use the 8092 port and GET /bucket/_design/[ddoc-name] HTTP method URI ending with the design document name.

    To retrieve all design documents in a cluster use the 8091 port with the /pools/default/buckets/[bucket-name]/ddocs URI.

    HTTP method and URI

    To retrieve all the design documents with views defined on a bucket:

    GET /[bucket-name]/_design/[ddoc-name]

    Request Data

    Design document definition (JSON)

    Response Data

    Success and stored design document ID

    Authentication Required




    Curl request syntax:

    curl -u [admin]:[password] -X GET
    HTTP response header includes a JSON document containing the metadata about the design document being accessed. The information is returned within the X-Couchbase-Meta header of the returned data. This information is retrieved by using the -v option to the curl command.

    To get design document information from the cluster, the following request is made on the 8091 port.

    curl -u [admin]:[password] -X GET


    Curl request example:

    To retrieve design doc information, the request must be made on the 8092 port.

    To get the existing design document from the bucket test2 for the development design document ruth and the view ruthView

    curl -u Administrator:password -X GET \

    To get design document information from the cluster, the request must be made on the 8091 port.

    curl -u Administrator:password -X GET \


    Response for the following example on the bucket test2 and the development design doc dev_ruth. The design document is empty because no data was added.

    curl -u Administrator:password -X GET \
        "views": {
            "johnView": {
                "map": "function (doc, meta) {\n  emit(, null);\n}"

    Response for the following request on the bucket test2.

    curl -u Administrator:password -X GET \
        "rows": [
                "controllers": {
                    "compact": "/pools/default/buckets/test2/ddocs/_design%2Fdev_ruth/controller/compactView",
                    "setUpdateMinChanges": "/pools/default/buckets/test2/ddocs/_design%2Fdev_ruth/controller/setUpdateMinChanges"
                "doc": {
                    "json": {
                        "views": {
                            "ruthView": {
                                "map": "function (doc, meta) {\n  emit(, null);\n}"
                    "meta": {
                        "id": "_design/dev_ruth",
                        "rev": "1-9bdf8353"

    The following response shows that the metadata matches the corresponding metadata for a data document.

          * About to connect() to port 8092 (#0)
          *   Trying
          % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
          Dload  Upload   Total   Spent    Left  Speed
          0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* connected
          * Connected to ( port 8092 (#0)
          * Server auth using Basic with user 'Administrator'
          > GET /sales/_design/something HTTP/1.1
          > Authorization: Basic QWRtaW5pc3RyYXRvcjpUYW1zaW4=
          > User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
          > Host:
          > Accept: */*
          > Content-Type: application/json
          < HTTP/1.1 200 OK
          < X-Couchbase-Meta: {"id":"_design/dev_sample","rev":"5-2785ea87","type":"json"}
          < Server: MochiWeb/1.0 (Any of you quaids got a smint?)
          < Date: Mon, 13 Aug 2012 10:45:46 GMT
          < Content-Type: application/json
          < Content-Length: 159
          < Cache-Control: must-revalidate
          { [data not shown]
          100   159  100   159    0     0  41930      0 --:--:-- --:--:-- --:--:-- 53000
          * Connection #0 to host left intact
          * Closing connection #0

    If the view does not exist, the following error is returned:


    Response codes

    Response codes Description


    Request completed successfully.


    The item requested was not available using the supplied authorization, or authorization was not supplied.


    The requested content could not be found. The returned content includes further information, as a JSON object, if available.