Creating a Collection

    • Developer Preview
      Collections can be created by means of the REST API.


      Collections are created by means of the POST /pools/default/buckets/<bucket_name>/collections/<scope_name> HTTP method and URI.

      HTTP Method and URI

      POST /pools/default/buckets/<bucket_name>/collections/<scope_name>

      Requires the name parameter, whose value is the name of the collection to be created.


      Curl request syntax is as follows:

      curl -X POST -v -u [admin]:[password]
        -d name=<name-of-collection>


      Curl request example:

      curl -X POST -v -u Administrator:password \
      testBucket/collections/my_scope \
      -d name=my_collection_in_my_scope_1

      Raw HTTP request example:

      POST /pools/default/buckets/testBucket/collections/my_scope HTTP/1.1
      Host: localhost:8091
      Content-Type: application/json
      Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==

      Response example:


      Response codes:

      HTTP/1.1 200 OK
      HTTP/1.1 401 Unauthorized
      HTTP/1.1 404 Object Not Found

      Possible errors:

      Requested resource not found.
      "name":"Length must be in range from 1 to 30"
      "name":"Can only contain characters A-Z, a-z, 0-9 and the following symbols _ - %"