Creating a Scope
- Developer Preview
Scopes can be created, by means of the REST API.
Description
Scopes are created by means of the POST /pools/default/buckets/<bucket_name>/collections/
HTTP method and URI.
HTTP Method and URI
POST /pools/default/buckets/<bucket_name>/collections
Requires the name
parameter, whose value is the name of the scope to be created.
Syntax
Curl request syntax is as follows:
curl -X POST -v -u [admin]:[password] http://<hostname-or-ip>:8091/pools/default/buckets/<bucket_name>/collections -d name=<name-of-scope>
Examples
Curl request example:
curl -X POST -v -u Administrator:password \ http://localhost:8091/pools/default/buckets/testBucket/collections \ -d name=my_scope
Raw HTTP request example:
POST /pools/default/buckets/testBucket/collections HTTP/1.1 Host: localhost:8091 Content-Type: application/json Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
Response example:
{"uid":17}
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 _ - %"