IBM Cloud API Docs

Introduction

IBM® Cloudant® for IBM Cloud® is a document-oriented database as a service (DBaaS). It stores data as documents in JSON format. It is built with scalability, high availability, and durability in mind. It comes with a wide variety of indexing options that include MapReduce, IBM Cloudant Query, full-text indexing, and geospatial indexing. The replication capabilities make it easy to keep data in sync between database clusters, desktop PCs, and mobile devices.

Detailed documentation is also available such as a Getting started tutorial, API overview documentation, tutorials, and guides.

If you intend to store sensitive information in an IBM® Cloudant® for IBM Cloud® database you must use client-side encryption to render data unreadable to Cloudant operators. For example for PCI DSS compliance you must encrypt the Primary Account Number (PAN) before sending a document containing it to the database.

This documentation describes the SDKs and examples. To see usage information and examples in your preferred SDK, select the language tab in the right pane.

This documentation describes the Java SDK and examples. To see usage information and examples in your preferred SDK, select the language tab in the right pane.

This documentation describes the Node SDK and examples. To see usage information and examples in your preferred SDK, select the language tab in the right pane.

This documentation describes the Python SDK and examples. To see usage information and examples in your preferred SDK, select the language tab in the right pane.

This documentation describes the Go SDK and examples. To see usage information and examples in your preferred SDK, select the language tab in the right pane.

The code examples on this tab use the IBM Cloudant SDK for Java&trade.

Gradle

implementation 'com.ibm.cloud:cloudant:0.+'

Maven

GitHub

The code examples on this tab use the IBM Cloudant SDK for Node.js.

Installation

npm install --save @ibm-cloud/cloudant

GitHub

The code examples on this tab use the IBM Cloudant SDK for Python.

Installation

pip3 install ibmcloudant

GitHub

The code examples on this tab use the IBM Cloudant SDK for Go.

Installation

go get -u github.com/IBM/cloudant-go-sdk/cloudantv1

GitHub

Endpoint URLs

The IBM Cloudant API uses an instance-specific endpoint URL for all regions. You can find your external endpoint by following these steps:

  1. Go to the IBM Cloud dashboard and open an instance.
  2. Click the Service credentials tab.
  3. Click the chevron next to the service credentials to open the credentials pane.
  4. Copy the value from the host field and prefix it with the https:// protocol. This value is the external endpoint.

For more information, see the Locating your service credentials tutorial.

Or you can copy your external endpoint by following these steps:

  1. Go to the IBM Cloud dashboard and open an instance.
  2. Under the Manage tab on the Overview page, see the External endpoint in the table.
  3. Click Copy to copy the External endpoint. Paste the endpoint where you need your credentials.

A public endpoint looks something like these examples:

https://5lll032-dd12-536e-09b3-432fg9f07e78-bluemix.cloudantnosqldb.appdomain.cloud

or

https://5lll032-dd12-536e-09b3-432fg9f07e78-bluemix.cloudant.com

A private endpoint is one that is only accessible through a non-public network, like IBM's internal network. Private endpoints are available to customers who have the Dedicated Hardware plan.

Authentication

You can access IBM Cloudant with IBM Cloud® Identity and Access Management (IAM) or IBM Cloudant legacy access controls. The choice between Use only IAM and Use both legacy credentials and IAM access control affects how credentials are delivered to your application when you bind and generate service credentials.

The Use only IAM option is preferred. Review Must I use Use only IAM or Use both legacy credentials and IAM? to help with making a decision.

IAM authentication

Access to IBM Cloudant is centrally controlled by IBM Cloud® Identity and Access Management (IAM), which provides a unified approach to managing user identities, and access control across your IBM Cloud® services and applications using the same set of credentials.

To work with the API, authenticate your application or service by including your IBM Cloud® IAM access token in API requests.

Cloudant legacy authentication

Legacy access controls are unique to IBM Cloudant, which means that accessing each service instance requires its own set of credentials. These credentials can be used with HTTP basic and cookie authentication. IBM Cloudant legacy API keys authenticate identically to username and password credentials but are generated and assigned differently. For more information, see the documentation about IBM Cloudant legacy API keys.

Additional authentication resources

  • IBM Cloudant client libraries provide full integration with IAM's access controls and automatically retrieve an IAM access token when an appropriate IAM configuration is provided (for example, an IAM API key or IAM profile ID).
  • View IBM Cloudant authentication documentation.

Security scheme

Authentication to this API's methods uses one of the following security schemes.

Basic

Valid only for IBM Cloudant legacy authentication (including legacy IBM Cloudant API keys).

Authenticates with a Authorization: Basic {credentials} header where credentials is the Base64 encoding of your username and password joined by a single colon :.

Value
  • HTTP
  • Basic

Cookie

Valid only for IBM Cloudant legacy authentication (including legacy IBM Cloudant API keys).

Login session cookies can be created via the POST /_session endpoint and returned in the standard Set-Cookie header. This AuthSession cookie can be stored and returned to the server in the Cookie header on subsequent requests. This process is handled automatically by IBM Cloudant's SDKs and other cookie aware HTTP clients like browsers.

Value
  • API Key
  • Cookie
  • AuthSession

IAM

Valid only for Cloud Identity and Access Management authentication.

Authenticates with a Authorization: Bearer {access_token} header where access_token is calculated from an appropriate IAM configuration (for example from an IAM API key, or IAM profile ID). This process is handled automatically by IBM Cloudant's SDKs.

Value
  • HTTP
  • JWT
  • Bearer

Authentication with external configuration

In this scenario, the configuration is defined with an external credentials file and an authenticator that is constructed by SDK's authenticator factory during client initialization. Using the external credentials file avoids hardcoded credentials within the application code.

The default name of the credentials file is ibm-credentials.env. It is expected to be located in either the current directory or in the user's home directory. The path and name of the file can be controlled by using the IBM_CREDENTIALS_FILE environment variable.

Cloudant configuration properties start with a chosen service name prefix that identifies your service. By default it is CLOUDANT.

If you would like to rename your Cloudant service from CLOUDANT, or use multiple services at the same time you must use your defined service name as the prefix for all of your Cloudant related configuration properties. You also must use the same service name at instantiating your service.

This way each configuration property contains the service name along with the actual attribute name in the form <service-name>_<attribute-name> (for example CLOUDANT_APIKEY).

It is not necessary to use a .env file. These properties can be set by using environment variables with the same name in the environment where the application is run.

Variable guide for the authentication code samples

Table 1. Variable signing guide
Attribute name Description
{apikey} IAM API key
{username} Cloudant username
{password} Cloudant password
{url} URL of Cloudant instance
{service-name} Chosen service name of your Cloudant instance.
Same as the prefix of your configuration properties.
Default value is CLOUDANT.

SDK managing the IAM token. Replace {apikey} and {url}.

{service-name}_URL={url}
{service-name}_APIKEY={apikey}
import com.ibm.cloud.cloudant.v1.Cloudant;

Cloudant service = Cloudant.newInstance("{service-name}");
import { CloudantV1 } from '@ibm-cloud/cloudant';

const service = CloudantV1.newInstance({
    serviceName: '{service-name}'
});
from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance(service_name="{service-name}")
import (
    "github.com/IBM/cloudant-go-sdk/cloudantv1"
)

service, err := cloudantv1.NewCloudantV1UsingExternalConfig(
    &cloudantv1.CloudantV1Options{
        ServiceName: "{service-name}",
    },
)

SDK managing session cookie.

{service-name}_AUTH_TYPE=COUCHDB_SESSION
{service-name}_URL={url}
{service-name}_USERNAME={username}
{service-name}_PASSWORD={password}
import com.ibm.cloud.cloudant.v1.Cloudant;

Cloudant service = Cloudant.newInstance("{service-name}");
import { CloudantV1 } from '@ibm-cloud/cloudant';

const service = CloudantV1.newInstance({
    serviceName: '{service-name}'
});
from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance(service_name="{service-name}")
import (
    "github.com/IBM/cloudant-go-sdk/cloudantv1"
)

service, err := cloudantv1.NewCloudantV1UsingExternalConfig(
    &cloudantv1.CloudantV1Options{
        ServiceName: "{service-name}",
    },
)

Basic authentication.

{service-name}_AUTH_TYPE=BASIC
{service-name}_URL={url}
{service-name}_USERNAME={username}
{service-name}_PASSWORD={password}
import com.ibm.cloud.cloudant.v1.Cloudant;

Cloudant service = Cloudant.newInstance("{service-name}");
import { CloudantV1 } from '@ibm-cloud/cloudant';

const service = CloudantV1.newInstance({
    serviceName: '{service-name}'
});
from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance(service_name="{service-name}")
import (
    "github.com/IBM/cloudant-go-sdk/cloudantv1"
)

service, err := cloudantv1.NewCloudantV1UsingExternalConfig(
    &cloudantv1.CloudantV1Options{
        ServiceName: "{service-name}",
    },
)

Programmatic authentication

In this scenario, authentication is configured by constructing an authenticator instance, supplying the configuration attributes programmatically, and then passing this instance to a client constructor.

If you are using the IBM Cloud App Service, IBM Cloud® Continuous Delivery or IBM Cloud starter kits then you can programmatically configure your SDK using the IBMCloudEnv tool to obtain the configuration information from bound services. The IBMCloudEnv tool is available for Go, Java&trade (Spring), Node.js, and Python.

SDK managing the IAM token.

import com.ibm.cloud.cloudant.v1.Cloudant;
import com.ibm.cloud.sdk.core.security.IamAuthenticator;

IamAuthenticator authenticator = new IamAuthenticator.Builder()
    .apikey("{apikey}")
    .build();

Cloudant service = new Cloudant(Cloudant.DEFAULT_SERVICE_NAME, authenticator);

service.setServiceUrl("{url}");
import { CloudantV1 } from '@ibm-cloud/cloudant';
import { IamAuthenticator } from 'ibm-cloud-sdk-core';

const authenticator = new IamAuthenticator({
    apikey: '{apikey}'
});

const service = new CloudantV1({
    authenticator: authenticator
});

service.setServiceUrl('{url}');
from ibmcloudant.cloudant_v1 import CloudantV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')

service = CloudantV1(authenticator=authenticator)

service.set_service_url('{url}')
import (
    "github.com/IBM/cloudant-go-sdk/cloudantv1"
    "github.com/IBM/go-sdk-core/core"
)

authenticator := &core.IamAuthenticator{
    ApiKey: "{apikey}",
}

service, err := cloudantv1.NewCloudantV1(
    &cloudantv1.CloudantV1Options{
        URL:           "{url}",
        Authenticator: authenticator,
    },
)
if err != nil {
    panic(err)
}

SDK managing session cookie.

import com.ibm.cloud.cloudant.v1.Cloudant;
import com.ibm.cloud.sdk.core.security.Authenticator;
import com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator;

Authenticator authenticator = CouchDbSessionAuthenticator.newAuthenticator("{username}", "{password}");

Cloudant service = new Cloudant(Cloudant.DEFAULT_SERVICE_NAME, authenticator);

service.setServiceUrl("{url}");
import { CloudantV1, CouchdbSessionAuthenticator } from '@ibm-cloud/cloudant';

const authenticator = new CouchdbSessionAuthenticator({
    username: '{username}',
    password: '{password}'
});

const service = new CloudantV1({
    authenticator: authenticator
});

service.setServiceUrl('{url}');
from ibmcloudant.cloudant_v1 import CloudantV1
from ibmcloudant import CouchDbSessionAuthenticator

authenticator = CouchDbSessionAuthenticator('{username}', '{password}')

service = CloudantV1(authenticator=authenticator)

service.set_service_url('{url}')
import (
    "github.com/IBM/cloudant-go-sdk/cloudantv1"
    "github.com/IBM/cloudant-go-sdk/auth"
)

authenticator, err := auth.NewCouchDbSessionAuthenticator(
    "{username}",
    "{password}",
)
if err != nil {
    panic(err)
}

service, err := cloudantv1.NewCloudantV1(
    &cloudantv1.CloudantV1Options{
        URL:           "{url}",
        Authenticator: authenticator,
    },
)
if err != nil {
    panic(err)
}

Basic authentication.

import com.ibm.cloud.cloudant.v1.Cloudant;
import com.ibm.cloud.sdk.core.security.BasicAuthenticator;

BasicAuthenticator authenticator = new BasicAuthenticator.Builder()
    .username("{username}")
    .password("{password}")
    .build();

Cloudant service = new Cloudant(Cloudant.DEFAULT_SERVICE_NAME, authenticator);

service.setServiceUrl("{url}");
import { CloudantV1 } from '@ibm-cloud/cloudant';
import { BasicAuthenticator } from 'ibm-cloud-sdk-core';

const authenticator = new BasicAuthenticator({
    username: '{username}',
    password: '{password}'
});

const service = new CloudantV1({
    authenticator: authenticator
});

service.setServiceUrl('{url}');
from ibmcloudant.cloudant_v1 import CloudantV1
from ibm_cloud_sdk_core.authenticators import BasicAuthenticator

authenticator = BasicAuthenticator('{username}', '{password}')

service = CloudantV1(authenticator=authenticator)

service.set_service_url('{url}')
import (
    "github.com/IBM/cloudant-go-sdk/cloudantv1"
    "github.com/IBM/go-sdk-core/core"
)

authenticator, err := core.NewBasicAuthenticator(
    "{username}",
    "{password}",
)
if err != nil {
    panic(err)
}

service, err := cloudantv1.NewCloudantV1(
    &cloudantv1.CloudantV1Options{
        URL:           "{url}",
        Authenticator: authenticator,
    },
)
if err != nil {
    panic(err)
}

Error handling

IBM Cloudant operation uses standard HTTP response codes to indicate the status of the requested method. HTTP response codes in the 2xx range indicate success. A 4xx range indicates a failure, and a 5xx range usually indicates an internal system error. More detailed information can be found in the body of the response.

List of HTTP codes

HTTP Code Meaning
200 - OK Request completed successfully.
201 - Created Resource that is created or updated successfully. The resource could be a database or a document, for example.
202 - Accepted Request was accepted, but the quorum for the operation was not met.
206 - Partial Content Request was successful and the body contains the ranges of data, as described in the Range header of the request.
304 - Not Modified The content that is requested was not modified. This error is used with the ETag system to identify the version of information returned.
400 - Bad Request Bad request structure. The error can indicate an error with the request URL, path, or headers. Differences in the supplied MD5 hash and content also trigger this error, as this error might indicate message corruption.
401 - Unauthorized The item requested was not available with the supplied authorization, or authorization was not supplied.
402 - Payment required Either the data quota on the Lite plan was exceeded, or the account is in arrears. You can delete data or upgrade to the Standard plan, or bring the account up to date.
403 - Forbidden The requested item or operation is forbidden.
404 - Not Found The requested resource could not be found. The content includes further information as a JSON object, if available. The structure contains two keys, error and reason, similar to the following example: { "error":"not_found", "reason":"no_db_file" }
405 - Resource Not Allowed A request was made by using an invalid HTTP request type for the URL requested. For example, you requested a PUT when a POST is expected. Errors of this type can also be triggered by invalid URL strings.
406 - Not Acceptable The requested content type is not supported by the server.
408 - Request Timeout Timeout during reading client request.
410 - Gone The requested resource is no longer available.
409 - Conflict Request resulted in an update conflict.
The two most common causes are:
1. Trying to update or delete a document without providing a revision.
2. The latest revision of the document on the server changed in between a fetch and an update.
412 - Precondition Failed The request headers from the client and the capabilities of the server do not match. Alternatively, a request to create a database was denied because the database exists.
413 - Request Entity Too Large The request size exceeded the limit for the IBM Cloudant API.
415 - Bad Content Type The content types supported and the content type of the information that was requested or submitted. The error indicates that the content type is not supported.
416 - Requested Range Not Satisfiable The range that is specified in the request header cannot be satisfied by the server.
429 - Too Many Requests The user sent too many requests in a specific amount of time. More information is available in the corresponding RFC 6585.
500 - Internal Server Error The request could not be completed by the server. It could be due to an internal error or in some cases invalid data in the request. Alternatively, a replication was canceled while in progress.
502 - Bad Gateway The server while acting as a gateway or proxy, received an invalid response from the upstream server.
503 - Service Unavailable The request could not be processed. Seeing this response might indicate a misspelled IBM Cloudant account name.
504 - Gateway Timeout Timeout when the server is acting as a gateway and cannot get a response in time.

Error response

Name Description
error string the error message returned in the response
reason string a more detailed description about the cause of the failure
caused_by (optional) string the cause of the error

Error Responses specific to /_api/v2/ endpoints

Name Description
code integer HTTP error code
error string a more detailed description about the cause of the failure
Name Description
message string detailed description about the cause of the failure

Error Response

{
  "error":"bad_request",
  "reason":"invalid UTF-8 JSON"
}

Error Responses specific to /_api/v2/ endpoints

{
    "code": 404,
    "error": "Could not find Cloudant user"
}
{
    "message": "The method is not allowed for the requested URL."
}

Code example

If an error response is received from the server endpoint, the Go SDK will create an error object that contains either the HTTP response error message or a generic error message.

An additional detailedResponse will be returned by the service that will contain the following fields:

Field Description
StatusCode HTTP response status code
Result JSON error response object unmarshalled as map[string]interface{}
RawResult raw non-JSON error response object as []byte

Example error handling

_, detailedResponse, err := // Invoke a Cloudant method request
if err != nil {
    if (detailedResponse != nil) {
      fmt.Println("Error status code: ", detailedResponse.StatusCode)
      fmt.Println("Error message:     ", err.Error())
      errorMap, ok := detailedResponse.GetResultAsMap(); if ok {
        fmt.Println("Reason:          ", errorMap["reason"])
      }
    } else {
      // Handle other error conditions
      fmt.Println("Error message: ", err.Error())
    }
  }

Code example

If an error response is received from the server endpoint, the Java&trade SDK will throw an exception from the com.ibm.cloud.sdk.core.service.exception package. The base class for all exception classes is ServiceResponseException - that derives from RuntimeException - to handle any error response from the server. Here is a list about predefined exceptions and their corresponding statusCode and message content.

Exception Status Code and default error message
ServiceResponseException Base class for all exceptions
BadRequestException 400 Bad Request
UnauthorizedException 401 Unauthorized
ForbiddenException 403 Forbidden
NotFoundException 404 Not found
ConflictException 409 Conflict
UnsupportedException 415 Unsupported media type
InternalServerErrorException 500 Internal server error
IllegalArgumentException An invalid argument was passed to the method.

All service exceptions contain the following fields:

Field Description
statusCode HTTP response status code
message the error message returned in the response
debuggingInfo a Map<String, Object> which contains the unmarshalled error response object if a JSON error response is returned.
This will provide more information beyond the error message.

Example error handling

import com.ibm.cloud.sdk.core.service.exception.BadRequestException;
import com.ibm.cloud.sdk.core.service.exception.NotFoundException;
import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException;
import com.ibm.cloud.sdk.core.service.exception.UnauthorizedException;
import com.ibm.cloud.sdk.core.service.exception.IllegalArgumentException;

try {
  // Invoke a Cloudant method request
} catch (BadRequestException e) {
  // Handle Bad Request (400) exception
} catch (UnauthorizedException e) {
  // Handle Unauthorized (401) exception
} catch (NotFoundException e) {
  // Handle Not Found (404) exception
} catch (ServiceResponseException se) {
  System.out.println("Service returned status code "
    + se.getStatusCode() + ": " + se.getMessage());
  System.out.println("Detailed error info: " + se.getDebuggingInfo().getOrDefault("reason", "")););
} catch (RuntimeException re) {
  // Handle other error conditions
  System.out.println("Unexpected Exception:\n" + re.getMessage());
} catch (IllegalArgumentException iae) {
  // Handle invalid argument value
  System.out.println("Invalid argument value:\n" + iae.getMessage());
}

Code example

If an error response is received from the server endpoint, the Node SDK will create an Error object that contains either the HTTP response error message or a generic error message. In case of network problems the axios package will generate an Error object. This Error object is passed as the first parameter to the callback function, its failure describing content is as shown in the following table.

Field Description
status HTTP response status code
statusText a text description of the status code
message generic error message
result error JSON response body as an object

Example error handling

service.CloudantMethod(params)
  .then((response) => {
    // ...handle successful response...
  })
  .catch(error => {
    if (error.code !== undefined && error.code === "ERR_INVALID_ARG_VALUE") {
      // The request was not sent, so there is no error status code, text and body
      console.log("Invalid argument value: \n" + error.message);
    } else {
      console.log(`Error status code:     ${error.status}`);
      console.log(`Error status text:     ${error.statusText}`);
      console.log(`Error message:         ${error.message}`);
      console.log(`Cloudant error:        ${error.result.error}`);
      console.log(`Cloudant error reason: ${error.result.reason}`);
    }
  });

Code example

If an error response is received from the server endpoint, the Python SDK will throw an ApiException that includes more information about the cause of the failure. It provides the following details:

Field Description
code HTTP response status code
message the error message returned in the response
reason a more detailed description about the cause of the failure

Example error handling

from ibm_cloud_sdk_core import ApiException

try:
  # Invoke a Cloudant method request
except ApiException as ae:
  print("Method failed")
  print(" - status code: " + str(ae.status_code))
  print(" - error message: " + ae.message)
  if ("reason" in ae.http_response.json()):
    print(" - reason: " + ae.http_response.json()["reason"])

Other errors

HTTP API requests may also not complete successfully due to error conditions in the network. This condition will cause IBM Cloudant request to fail.

An example would be an HTTP request timeout. In this case the request returns detailedResponse with only StatusCode - Result and RawResult elements will be nil.

Argument validation prevents invalid values and stops the request from being sent. This results in Result and RawResult objects being nil, and a returned error message with no status code or reason.

In all other cases, detailedResponse will be nil because it is returned only by IBM Cloudant Service.

In this case, an IOException will be thrown and will be wrapped in a RuntimeException.

Argument validation prevents invalid values and stops the request from being sent. Invalid argument values raise an IllegalArgumentException exception.

In this case, the status will be undefined and body content will be non-JSON formatted error description.

Argument validation prevents invalid values and stops the request from being sent. Invalid argument values raise an Error object containing a code field with the value ERR_INVALID_ARG_VALUE.

In this case, the requests package will raise specific exceptions for these problems.

Argument validation prevents invalid values and stops the request from being sent. Invalid argument values raise an ValueError exception.

from requests import ConnectionError, ReadTimeout, RequestException, ValueError

try:
  # Invoke a Cloudant method request
except ConnectionError as cerr:
  print("Connection error occurred:")
  print(cerr)
except ReadTimeout as rt:
  # The server did not send any data in the allotted amount of time.
  print("Read timed out:")
  print(rt)
except RequestException as re:
  # Handle other request failures
  print("Request Exception:")
  print(re)
except ValueError as ve:
  print("Invalid argument value:\n" + ve.message)

Auditing

You can monitor API activity within your account by using the IBM Cloud® Activity Tracker service. An event is generated for most of the API endpoints when they are called, and you can then track and audit from within Activity Tracker. The specific event type is listed for each individual method. For methods that don't list any events, no events are generated.

For more information about how to track IBM Cloudant activity, see Audit logging.

Additional headers

Because IBM Cloudant uses HTTP for all external communication, you need to ensure that the correct HTTP request headers are supplied and processed on retrieval. This course of action ensures that you get the correct format and encoding. Different environments and clients are more or less strict on the effect of these HTTP headers, especially when they are not present. To reduce the likelihood of problems or unexpected behavior, you must be as specific as possible.

Request headers

The supported HTTP request headers are shown in the following list:

  • Accept
  • Content-Type
  • Content-Encoding
  • If-None-Match
  • Range

Accept

The Accept header specifies the list of potential data types that are returned by the server that would be accepted and understood by the client. The format is a list of one or more MIME types, which are separated by colons.

For the most requests, the accepted list must include JSON data (application/json).

For attachments, you can either specify the MIME type explicitly, or use */* to specify that all file types are supported.

If the Accept header is not supplied, then the server assumes the */* MIME type, which means that the client accepts all formats.

See the following example of sending a request without an explicit Accept header, or when you specify */*:

GET /recipes HTTP/1.1
Host: username.cloudant.com
Accept: */*

See the following example of a returned header when the client is assumed to accept all formats:

The returned content type is text/plain even though the information that is returned by the request is in JSON format.

Server: CouchDB/1.0.2 (Erlang OTP/R14B)
Date: Thu, 13 Jan 2011 13:39:34 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: #7
Cache-Control: must-revalidate

The use of Accept in queries to IBM Cloudant is not required, but is highly recommended as it helps to ensure that the data returned can be processed by the client.

If you specify a data type that uses the Accept header, IBM Cloudant honors the specified type in the Content-type header field of responses. For example, if you explicitly request application/json in the Accept of a request, the returned HTTP headers use this value in the returned Content-type field.

See the following example request that explicitly specifies the Accept header:

GET /recipes HTTP/1.1
Host: username.cloudant.com
Accept: application/json

See the following example of the headers returned in response, including the application/json content type:

Server: CouchDB/1.0.2 (Erlang OTP/R14B)
Date: Thu, 13 Jan 2011 13:40:11 GMT
Content-Type: application/json
Content-Length: #7
Cache-Control: must-revalidate

Content-Type for request headers

The Content-Type header specifies the content type of the information that is supplied within the request. The specification uses MIME type specifications. For most requests, the content type is JSON (application/json).

For some settings, the MIME type is plain text.

In particular, when you upload attachments the type must be the corresponding MIME type for the attachment or binary (application/octet-stream).

The use of the Content-Type on a request is highly recommended.

Content-Encoding

The Content-Encoding header specifies the encoding of the request body. The supported value is gzip. If the header is used, the request body must be encoded with the corresponding format.

See the following example of creating a compressed (gzipped) request body:

# create gzipped document
echo '{"foo":"bar"}' | gzip > doc.gzip

See the following example of sending a gzip-encoded request body to create a document by using HTTP:

PUT /db/doc HTTP/1.1
HOST: $ACCOUNT.cloudant.com
Content-Encoding: gzip

See the following example of sending a gzip-encoded request body to create a document by using the command line:

curl "https://$ACCOUNT.cloudant.com/db/doc" \
	-X PUT \
	-T doc.gzip \
	-H "Content-Encoding: gzip"

Range

The Range header specifies the parts of an attachment that the server should return. Several parts can be requested at the same time in one Range header, and the server may send back these ranges in a multipart document. If the server sends back ranges, it uses the status line 206 Partial Content for the response.

If-None-Match

The If-None-Match header is optional. You might send it to determine whether a document was modified since it was last read or updated. The value of the If-None-Match header must match the last Etag value received. If the value matches the current revision of the document, the server sends a 304 Not Modified status code, and the response itself has no body.

If the document was modified, you get a normal 200 response, provided the document still exists and no other errors occurred.

Response headers

Response headers are returned by the server when you send back content. They include a number of different fields. Many of the fields are standard HTTP response headers and have no significance regarding how IBM Cloudant operates. The supported HTTP response headers that are important to IBM Cloudant are as shown in the following list.

  • Cache-Control
  • Content-Length
  • Content-Range
  • Content-Type
  • Etag
  • Via
  • X-Content-Type-Options
  • X-Couch-Request-ID
  • X-Cloudant-Action
  • X-Cloudant-Backend
  • X-Cloudant-Request-Class
  • X-Frame-Options

The IBM Cloudant design document API and its functions return HTML (for example as part of a show or list). After which, you can include custom HTTP headers through the headers field of the return object.

Cache-Control

The Cache-Control HTTP response header provides a suggestion for the client cache mechanisms on how to treat the returned information. IBM Cloudant typically returns the must-revalidate value, which indicates that the information must be revalidated if possible. Revalidation ensures that the dynamic nature of the content is correctly updated.

Content-Length

The Content-Length header reports the length in bytes of the returned content.

Content-Type for response headers

The Content-Type header specifies the MIME type of the returned data. For most request, the returned MIME type is text/plain. All text is encoded in Unicode (UTF-8), which is explicitly stated in the returned Content-Type as text/plain;charset=utf-8.

Content-Range

The Content-Range header specifies where in the full document's attachment a partial content belongs. The value is in the form of bytes <range>/<total content length>. The Range request header is required to specify the partial content to be returned.

Etag

The Etag header is used to show the revision for a document, or the response from a show function. For documents, the value is identical to the revision of the document. The value can be used with an If-None-Match request header to get a 304 Not Modified response if the revision is still current.

ETags cannot currently be used with views or lists, since the ETags returned from those requests are random numbers that change on every request.

Via

A name of an individual reverse proxy server that processed the request.

X-Content-Type-Options

The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the MIME types advertised in the Content-Type headers should be followed and not be changed. This is a security feature to block content sniffing that could transform non-executable MIME types into executable MIME types. By default Cloudant returns X-Content-Type-Options: nosniff that blocks a request if the request destination is of type style and the MIME type is not text/css, or of type script and the MIME type is not a JavaScript MIME type.

X-Couch-Request-ID

A unique identifier for the request.

X-Cloudant-Action

An auditing event's action name generated for the request.

X-Cloudant-Backend

A name of an individual backend server that processed the request.

X-Cloudant-Request-Class

A request class assigned to the request that count towards the instance's throughput capacity's budget.

X-Frame-Options

The X-Frame-Options is a response header that controls whether an HTTP response can be embedded in a <frame>, <iframe> or <object>. This is a security feature to help against clickjacking. Cloudant returns X-Frame-Options: DENY by default.

Pagination

Certain API endpoints have a limit on results returned per page to avoid performance issues. The sections below describe the options available and list the endpoints you can use them on.

Paging on all documents and on views

The following endpoints have the limit and skip parameters which allow you to define how many documents you would like to see on a page, and the offset into the range you want to start the page from, but this pattern gets progressively slower the larger the value of skip gets. There are a couple of options which are more efficient than using the limit/skip pattern: either fetch one extra document, and use this document's id as the startKey of your request for the next page of results ("fetch one document too many"); or append \u0000 to the startKey, using the last id of the last document from your previous page of results ("the \u0000 trick").

The following endpoints have the Limit and Skip parameters which allow you to define how many documents you would like to see on a page, and the offset into the range you want to start the page from, but this pattern gets progressively slower the larger the value of Skip gets. There are a couple of options which are more efficient than using the Limit/Skip pattern: either fetch one extra document, and use this document's ID as the StartKey of your request for the next page of results ("fetch one document too many"); or append \u0000 to the StartKey, using the last ID of the last document from your previous page of results ("the \u0000 trick").

You can find examples and more explanation for both tricks in the Cloudant docs:

We recommend to use "the \u0000 trick" over "fetch one document too many".

Rate limiting

Rate limits for API requests are enforced on a per-service-instance basis. If the number of requests for a particular request class (read, write or global query) reaches the limit within the given time window, no further requests of that class are accepted until the next time window.

You can view your usage by using the Retrieve the current provisioned throughput capacity consumption API or the IBM Cloudant dashboard. IBM Cloudant does return an x-cloudant-request-class response header related to limiting.

x-cloudant-request-class response header returns the following request classes: read, write, global query, or unlimited.

If you want to learn more about these request classes, see the Request classes documentation.

A 429 HTTP status code indicates that the rate limit has been exceeded.

The number of allowed requests varies by request class. The reference information for each endpoint and method specifies the request class that applies to the request. The rate limit for each request class is determined by the account plan.

Most requests and responses to and from IBM® Cloudant® for IBM Cloud® use JavaScript Object Notation (JSON) for formatting the content and structure of the data and responses.

In IBM Cloudant databases, the JSON object is used to represent various structures, including all documents in a database.

Parsing JSON into a JavaScript object is supported through the JSON.parse() function in JavaScript, or through various libraries that perform the parsing of the content into a JavaScript object for you. Libraries for parsing and generating JSON are available for many major programming languages.

JSON is used because it's the simplest and easiest solution for working with data that uses a web browser. As a result, JSON structures can be evaluated and used as JavaScript objects within the web browser environment. JSON also integrates with the server-side JavaScript used within IBM Cloudant. JSON documents are always UTF-8 encoded.

Be careful to follow these guidelines:

  • Your JSON structures are valid.
  • You normalize strings in JSON documents retrieved from IBM Cloudant.

JSON supports the same basic types that are supported by JavaScript: numbers, strings, Booleans, arrays, and objects.

Numbers

Numbers can be integer or floating point values.

Example of a number in JSON format

123

Strings

Strings must be enclosed by double quotation marks. Strings support Unicode characters and escaping a backslash.

Example of a string in JSON format

"A String"

Booleans

A true or false value.

Example of a boolean in JSON format

{
  "value": true
}

Arrays

A list of values enclosed in brackets. The values that are enclosed can be any valid JSON.

Example of an array in JSON format

[
    "one",
    2,
    "three",
    [],
    true,
    {
        "foo":
        "bar"
    }
]

Example of an array in JSON format (linear)

[ "one", 2, "three", [], true, { "foo": "bar" } ]

Objects

A set of key-value pairs, such as an associative array, or a hash. The key must be a string, but the value can be any of the supported JSON values.

Example of a JSON object

{
    "servings" : 4,
    "subtitle" : "Easy to make in advance, and then cook when ready",
    "cooktime" : 60,
    "title" : "Chicken Coriander"
}

Logging

A basic logging facility is provided by the Go core library with levels Error, Info, Warn, and Debug. If Debug level is enabled, it displays HTTP request and response messages and retry attempts.

The Go core library also defines a Logger interface, where you can supply your own logging implementation. For example, you can direct the log messages to a file instead of the console.

The logging detail level can be configured by using the HttpConfigOptions class.

The SDK is using debug package for logging. In order to see the log output, set the environment variable DEBUG including the wanted log level.

To enable logging, import the logging package and then setting the log level to DEBUG.

// Enable Debug logging
core.SetLoggingLevel(core.LevelDebug)
HttpConfigOptions options =
    new HttpConfigOptions.Builder()
        .loggingLevel(HttpConfigOptions.LoggingLevel.BASIC)
    .build();

service.configureClient(options);
DEBUG=ibm-cloud-sdk-core:error    // enables error logs
DEBUG=ibm-cloud-sdk-core:warning  // enables warning logs and below
DEBUG=ibm-cloud-sdk-core:info     // enables info logs and below
DEBUG=ibm-cloud-sdk-core:verbose  // enables verbose logs and below
DEBUG=ibm-cloud-sdk-core:debug    // enables debug logs and below
import logging
logging.basicConfig(level=logging.DEBUG)

Methods

Retrieve server instance information

When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response includes a JSON structure that contains information about the server, including a welcome message and the server's version.

Tip: The authentication for this endpoint is only enforced when using IAM.

When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response includes a JSON structure that contains information about the server, including a welcome message and the server's version.

Tip: The authentication for this endpoint is only enforced when using IAM.

When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response includes a JSON structure that contains information about the server, including a welcome message and the server's version.

Tip: The authentication for this endpoint is only enforced when using IAM.

When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response includes a JSON structure that contains information about the server, including a welcome message and the server's version.

Tip: The authentication for this endpoint is only enforced when using IAM.

When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response includes a JSON structure that contains information about the server, including a welcome message and the server's version.

Tip: The authentication for this endpoint is only enforced when using IAM.

GET /
(cloudant *CloudantV1) GetServerInformation(getServerInformationOptions *GetServerInformationOptions) (result *ServerInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetServerInformationWithContext(ctx context.Context, getServerInformationOptions *GetServerInformationOptions) (result *ServerInformation, response *core.DetailedResponse, err error)
ServiceCall<ServerInformation> getServerInformation()
getServerInformation(params)
get_server_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-meta-info.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL"
    
  • getServerInformationOptions := service.NewGetServerInformationOptions()
    
    serverInformation, response, err := service.GetServerInformation(getServerInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(serverInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ServerInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    ServerInformation response =
        service.getServerInformation().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getServerInformation().then(response => {
        console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_server_information().get_result()
    
    print(response)
    

Response

Schema for information about the server instance.

Schema for information about the server instance.

Schema for information about the server instance.

Schema for information about the server instance.

Schema for information about the server instance.

Status Code

  • HTTP response for / style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ServerInformation response.

    {
      "couchdb": "Welcome",
      "features": [
        "access-ready",
        "iam",
        "partitioned",
        "pluggable-storage-engines",
        "scheduler"
      ],
      "features_flags": [
        "partitioned"
      ],
      "vendor": {
        "name": "IBM Cloudant",
        "variant": "paas",
        "version": "8162"
      },
      "version": "2.1.1"
    }
  • Example ServerInformation response.

    {
      "couchdb": "Welcome",
      "features": [
        "access-ready",
        "iam",
        "partitioned",
        "pluggable-storage-engines",
        "scheduler"
      ],
      "features_flags": [
        "partitioned"
      ],
      "vendor": {
        "name": "IBM Cloudant",
        "variant": "paas",
        "version": "8162"
      },
      "version": "2.1.1"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for a server instance

Retrieves the HTTP headers for a server instance.

HEAD /

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-meta-info.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for / style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve cluster membership information

Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.

Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.

Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.

Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.

Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.

GET /_membership
(cloudant *CloudantV1) GetMembershipInformation(getMembershipInformationOptions *GetMembershipInformationOptions) (result *MembershipInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetMembershipInformationWithContext(ctx context.Context, getMembershipInformationOptions *GetMembershipInformationOptions) (result *MembershipInformation, response *core.DetailedResponse, err error)
ServiceCall<MembershipInformation> getMembershipInformation()
getMembershipInformation(params)
get_membership_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-membership.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-membership.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_membership"
    
  • getMembershipInformationOptions := service.NewGetMembershipInformationOptions()
    
    membershipInformation, response, err := service.GetMembershipInformation(getMembershipInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(membershipInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.MembershipInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    MembershipInformation response =
        service.getMembershipInformation().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getMembershipInformation().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_membership_information().get_result()
    
    print(response)
    

Response

Schema for information about known nodes and cluster membership.

Schema for information about known nodes and cluster membership.

Schema for information about known nodes and cluster membership.

Schema for information about known nodes and cluster membership.

Schema for information about known nodes and cluster membership.

Status Code

  • HTTP response for /_membership style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example MembershipInformation response.

    {
      "all_nodes": [
        "node1@127.0.0.1",
        "node2@127.0.0.1",
        "node3@127.0.0.1"
      ],
      "cluster_nodes": [
        "node1@127.0.0.1",
        "node2@127.0.0.1",
        "node3@127.0.0.1"
      ]
    }
  • Example MembershipInformation response.

    {
      "all_nodes": [
        "node1@127.0.0.1",
        "node2@127.0.0.1",
        "node3@127.0.0.1"
      ],
      "cluster_nodes": [
        "node1@127.0.0.1",
        "node2@127.0.0.1",
        "node3@127.0.0.1"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for cluster membership

Retrieves the HTTP headers for cluster membership.

HEAD /_membership

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-membership.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-membership.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_membership style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve information about cluster reshard operations

Retrieves a summary of the shard splitting operations for the whole cluster.

GET /_reshard

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for the shard splitting cluster summary.

Status Code

  • HTTP response for /_reshard style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ReshardInformation response.

    {
      "completed": 3,
      "failed": 4,
      "running": 0,
      "state": "stopped",
      "state_reason": "Manual rebalancing.",
      "stopped": 0,
      "total": 7
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for cluster reshard operations

Retrieves the HTTP headers for cluster reshard operations.

HEAD /_reshard

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-reshard-jobs.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_reshard style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve a list of shard splitting jobs

List all shard splitting jobs.

GET /_reshard/jobs

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for a list of shard splitting jobs.

Status Code

  • HTTP response for /_reshard/jobs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ReshardJobsInformation response.

    {
      "jobs": [
        {
          "history": [
            {
              "detail": null,
              "timestamp": "2019-02-06T22:28:06Z",
              "type": "new"
            },
            {
              "detail": null,
              "timestamp": "2019-02-06T22:28:10Z",
              "type": "completed"
            }
          ],
          "id": "001-0a308ef9f7bd24bd4887d6e619682a6d3bb3d0fd94625866c5216ec1167b4e23",
          "job_state": "completed",
          "node": "node1@127.0.0.1",
          "source": "shards/00000000-ffffffff/db1.1549492084",
          "split_state": "completed",
          "start_time": "2019-02-06T22:28:06Z",
          "state_info": {},
          "target": [
            "shards/00000000-7fffffff/db1.1549492084",
            "shards/80000000-ffffffff/db1.1549492084"
          ],
          "type": "split",
          "update_time": "2019-02-06T22:28:10Z"
        }
      ],
      "offset": 0,
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers of shard splitting jobs

Retrieves the HTTP headers for shard splitting jobs.

HEAD /_reshard/jobs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-reshard-jobs.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_reshard/jobs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create shard splitting jobs

Create shard splitting jobs.

POST /_reshard/jobs

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs.write

Request

HTTP request body for postReshardJobsConfiguration.

Examples:
ReshardJobsConfiguration

Response

Schema for the result of a shard splitting jobs response.

Status Code

  • HTTP response for postReshardJobsConfiguration.

  • HTTP response for postReshardJobsConfiguration.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP response for postReshardJobsConfiguration.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example postReshardJobsConfiguration response.

    [
      {
        "id": "001-30d7848a6feeb826d5e3ea5bb7773d672af226fd34fd84a8fb1ca736285df557",
        "node": "node1@127.0.0.1",
        "ok": "true,",
        "shard": "shards/80000000-ffffffff/db3.1554148353"
      },
      {
        "id": "001-40d7848a6feeb826d5e3ea5bb7773d672af226fd34fd84a8fb1ca736285df600",
        "node": "node2@127.0.0.1",
        "ok": "true,",
        "shard": "shards/80000000-ffffffff/db3.1554148353"
      }
    ]
  • Example postReshardJobsConfiguration response.

    [
      {
        "id": "001-30d7848a6feeb826d5e3ea5bb7773d672af226fd34fd84a8fb1ca736285df557",
        "node": "node1@127.0.0.1",
        "ok": "true,",
        "shard": "shards/80000000-ffffffff/db3.1554148353"
      },
      {
        "id": "001-40d7848a6feeb826d5e3ea5bb7773d672af226fd34fd84a8fb1ca736285df600",
        "node": "node2@127.0.0.1",
        "ok": "true,",
        "shard": "shards/80000000-ffffffff/db3.1554148353"
      }
    ]
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example postReshardJobsConfiguration response.

    [
      {
        "id": "001-30d7848a6feeb826d5e3ea5bb7773d672af226fd34fd84a8fb1ca736285df557",
        "node": "node1@127.0.0.1",
        "ok": "true,",
        "shard": "shards/80000000-ffffffff/db3.1554148353"
      },
      {
        "id": "001-40d7848a6feeb826d5e3ea5bb7773d672af226fd34fd84a8fb1ca736285df600",
        "node": "node2@127.0.0.1",
        "ok": "true,",
        "shard": "shards/80000000-ffffffff/db3.1554148353"
      }
    ]
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete a shard splitting job

Stop and remove a shard splitting job.

DELETE /_reshard/jobs/{reshard_job_id}

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-job.delete

Request

Path Parameters

  • Path parameter to specify the shard splitting job ID.

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about a shard splitting job

Retrieves the state of a shard splitting job.

GET /_reshard/jobs/{reshard_job_id}

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-job.read

Request

Path Parameters

  • Path parameter to specify the shard splitting job ID.

Response

Schema for the state of a shard splitting job.

Status Code

  • HTTP response for /_reshard/jobs/{reshard_job_id} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ReshardJobInformation response.

    {
      "history": [
        {
          "detail": {
            "timestamp": "2019-02-06T22:28:06Z",
            "type": "new"
          }
        },
        {
          "detail": {
            "timestamp": "2019-02-06T22:28:10Z",
            "type": "completed"
          }
        }
      ],
      "id": "001-0a308ef9f7bd24bd4887d6e619682a6d3bb3d0fd94625866c5216ec1167b4e23",
      "job_state": "completed",
      "node": "node1@127.0.0.1",
      "source": "shards/00000000-ffffffff/db1.1549492084",
      "split_state": "completed",
      "start_time": "2019-02-06T22:28:06Z",
      "target": [
        "shards/00000000-7fffffff/db1.1549492084",
        "shards/80000000-ffffffff/db1.1549492084"
      ],
      "type": "split",
      "update_time": "2019-02-06T22:28:10Z"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about a shard splitting job

Retrieves the state of a shard splitting job.

HEAD /_reshard/jobs/{reshard_job_id}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-reshard-job.read

Request

Path Parameters

  • Path parameter to specify the shard splitting job ID.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_reshard/jobs/{reshard_job_id} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve the running state of a shard splitting job

Retrieves the running state of a shard splitting job.

GET /_reshard/jobs/{reshard_job_id}/state

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs-state.read

Request

Path Parameters

  • Path parameter to specify the shard splitting job ID.

Response

Schema for the state information of a shard splitting job.

Status Code

  • HTTP response for /_reshard/state style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example request or response body for the state of cluster resharding.

    {
      "reason": "Pause resharding across the cluster.",
      "state": "stopped"
    }
  • Example request or response body for the state of a reshard job.

    {
      "reason": "Pause this job for now.",
      "state": "stopped"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers of a shard splitting job

Retrieves the HTTP headers of a shard splitting job.

HEAD /_reshard/jobs/{reshard_job_id}/state

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-reshard-jobs-state.read

Request

Path Parameters

  • Path parameter to specify the shard splitting job ID.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_reshard/state style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Update the running state of a shard splitting job

Update the running state of a shard splitting job. The state can be changed from stopped to running or from running to stopped. If an individual job is stopped via this API it will stay stopped even after the global resharding state is toggled from stopped to running. If the job is already completed its state will stay completed.

PUT /_reshard/jobs/{reshard_job_id}/state

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs-state.write

Request

Path Parameters

  • Path parameter to specify the shard splitting job ID.

HTTP request body for putReshardState or putReshardJobState.

Examples:
ReshardStateCluster
ReshardStateJob

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the state of shard splitting across the cluster

Retrieves the state of shard splitting across the cluster.

GET /_reshard/state

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs-state.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for the state information of a shard splitting job.

Status Code

  • HTTP response for /_reshard/state style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example request or response body for the state of cluster resharding.

    {
      "reason": "Pause resharding across the cluster.",
      "state": "stopped"
    }
  • Example request or response body for the state of a reshard job.

    {
      "reason": "Pause this job for now.",
      "state": "stopped"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers of shard splitting across the cluster

Retrieves the HTTP headers of shard splitting across the cluster.

HEAD /_reshard/state

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_reshard/state style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Enable/disable shard splitting across the cluster

Enable/disable shard splitting across the cluster. The states are stopped or running. This starts and stops global resharding on all the nodes of the cluster. If there are any running jobs, they will be stopped when the state changes to stopped. When the state changes back to running those job will continue running.

PUT /_reshard/state

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-reshard-jobs-state.write

Request

HTTP request body for putReshardState or putReshardJobState.

Examples:
ReshardStateCluster
ReshardStateJob

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve one or more UUIDs

Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs.

Tip: The authentication for this endpoint is only enforced when using IAM.

Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs.

Tip: The authentication for this endpoint is only enforced when using IAM.

Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs.

Tip: The authentication for this endpoint is only enforced when using IAM.

Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs.

Tip: The authentication for this endpoint is only enforced when using IAM.

Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs.

Tip: The authentication for this endpoint is only enforced when using IAM.

GET /_uuids
(cloudant *CloudantV1) GetUuids(getUuidsOptions *GetUuidsOptions) (result *UuidsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetUuidsWithContext(ctx context.Context, getUuidsOptions *GetUuidsOptions) (result *UuidsResult, response *core.DetailedResponse, err error)
ServiceCall<UuidsResult> getUuids(GetUuidsOptions getUuidsOptions)
getUuids(params)
get_uuids(
        self,
        *,
        count: Optional[int] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-uuids.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-uuids.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetUuidsOptions struct and set the fields to provide parameter values for the GetUuids method.

Use the GetUuidsOptions.Builder to create a GetUuidsOptions object that contains the parameter values for the getUuids method.

Query Parameters

  • Query parameter to specify the number of UUIDs to return.

    Possible values: 1 ≤ value ≤ 1000

    Default: 1

WithContext method only

The GetUuids options.

The getUuids options.

parameters

  • Query parameter to specify the number of UUIDs to return.

    Possible values: 1 ≤ value ≤ 1000

    Default: 1

parameters

  • Query parameter to specify the number of UUIDs to return.

    Possible values: 1 ≤ value ≤ 1000

    Default: 1

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_uuids?count=10"
    
  • getUuidsOptions := service.NewGetUuidsOptions()
    getUuidsOptions.SetCount(10)
    
    uuidsResult, response, err := service.GetUuids(getUuidsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(uuidsResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.UuidsResult;
    
    Cloudant service = Cloudant.newInstance();
    
    GetUuidsOptions uuidsOptions = new GetUuidsOptions.Builder()
        .count(10)
        .build();
    
    UuidsResult response =
        service.getUuids(uuidsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const uuidsParams: CloudantV1.GetUuidsParams = {
      count: 10
    };
    
    service.getUuids(uuidsParams).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_uuids(count=10).get_result()
    
    print(response)
    

Response

Schema for a set of uuids generated by the server.

Schema for a set of uuids generated by the server.

Schema for a set of uuids generated by the server.

Schema for a set of uuids generated by the server.

Schema for a set of uuids generated by the server.

Status Code

  • HTTP response for /_uuids style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example UuidsResult response.

    {
      "uuids": [
        "75480ca477454894678e22eec6002413",
        "75480ca477454894678e22eec600250b",
        "75480ca477454894678e22eec6002c41",
        "75480ca477454894678e22eec6003b90",
        "75480ca477454894678e22eec6003fca",
        "75480ca477454894678e22eec6004bef",
        "75480ca477454894678e22eec600528f",
        "75480ca477454894678e22eec6005e0b",
        "75480ca477454894678e22eec6006158",
        "75480ca477454894678e22eec6006161"
      ]
    }
  • Example UuidsResult response.

    {
      "uuids": [
        "75480ca477454894678e22eec6002413",
        "75480ca477454894678e22eec600250b",
        "75480ca477454894678e22eec6002c41",
        "75480ca477454894678e22eec6003b90",
        "75480ca477454894678e22eec6003fca",
        "75480ca477454894678e22eec6004bef",
        "75480ca477454894678e22eec600528f",
        "75480ca477454894678e22eec6005e0b",
        "75480ca477454894678e22eec6006158",
        "75480ca477454894678e22eec6006161"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for one or more UUIDs

Retrieves the HTTP headers for one or more UUIDs.

HEAD /_uuids

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.cluster-uuids.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.cluster-uuids.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_uuids style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve provisioned throughput capacity information

View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the target provisioned throughput capacity.

View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the target provisioned throughput capacity.

View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the target provisioned throughput capacity.

View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the target provisioned throughput capacity.

View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the target provisioned throughput capacity.

GET /_api/v2/user/capacity/throughput
(cloudant *CloudantV1) GetCapacityThroughputInformation(getCapacityThroughputInformationOptions *GetCapacityThroughputInformationOptions) (result *CapacityThroughputInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetCapacityThroughputInformationWithContext(ctx context.Context, getCapacityThroughputInformationOptions *GetCapacityThroughputInformationOptions) (result *CapacityThroughputInformation, response *core.DetailedResponse, err error)
ServiceCall<CapacityThroughputInformation> getCapacityThroughputInformation()
getCapacityThroughputInformation(params)
get_capacity_throughput_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-capacity-throughput.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-capacity-throughput.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • ibmcloud cloudant capacity
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" "$SERVICE_URL/_api/v2/user/capacity/throughput"
    
  • getCapacityThroughputInformationOptions := service.NewGetCapacityThroughputInformationOptions()
    
    capacityThroughputInformation, response, err := service.GetCapacityThroughputInformation(getCapacityThroughputInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(capacityThroughputInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    CapacityThroughputInformation response =
        service.getCapacityThroughputInformation().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getCapacityThroughputInformation().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_capacity_throughput_information().get_result()
    
    print(response)
    

Response

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Status Code

  • HTTP response for getCapacityThroughputInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example CapacityThroughputInformation response.

    {
      "current": {
        "throughput": {
          "blocks": 5,
          "query": 25,
          "read": 500,
          "write": 250
        }
      },
      "target": {
        "throughput": {
          "blocks": 10,
          "query": 50,
          "read": 1000,
          "write": 500
        }
      }
    }
  • Example CapacityThroughputInformation response.

    {
      "current": {
        "throughput": {
          "blocks": 5,
          "query": 25,
          "read": 500,
          "write": 250
        }
      },
      "target": {
        "throughput": {
          "blocks": 10,
          "query": 50,
          "read": 1000,
          "write": 500
        }
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Update the target provisioned throughput capacity

Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the current capacity asynchronously changes to meet the target capacity.

Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the current capacity asynchronously changes to meet the target capacity.

Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the current capacity asynchronously changes to meet the target capacity.

Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the current capacity asynchronously changes to meet the target capacity.

Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the current capacity asynchronously changes to meet the target capacity.

PUT /_api/v2/user/capacity/throughput
(cloudant *CloudantV1) PutCapacityThroughputConfiguration(putCapacityThroughputConfigurationOptions *PutCapacityThroughputConfigurationOptions) (result *CapacityThroughputInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutCapacityThroughputConfigurationWithContext(ctx context.Context, putCapacityThroughputConfigurationOptions *PutCapacityThroughputConfigurationOptions) (result *CapacityThroughputInformation, response *core.DetailedResponse, err error)
ServiceCall<CapacityThroughputInformation> putCapacityThroughputConfiguration(PutCapacityThroughputConfigurationOptions putCapacityThroughputConfigurationOptions)
putCapacityThroughputConfiguration(params)
put_capacity_throughput_configuration(
        self,
        blocks: int,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-capacity-throughput.configure

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-capacity-throughput.configure

Request

Instantiate the PutCapacityThroughputConfigurationOptions struct and set the fields to provide parameter values for the PutCapacityThroughputConfiguration method.

Use the PutCapacityThroughputConfigurationOptions.Builder to create a PutCapacityThroughputConfigurationOptions object that contains the parameter values for the putCapacityThroughputConfiguration method.

HTTP request body for putCapacityThroughputConfiguration.

Examples:
CapacityThroughputConfiguration

WithContext method only

The PutCapacityThroughputConfiguration options.

The putCapacityThroughputConfiguration options.

parameters

  • A number of blocks of throughput units. A block consists of 100 reads/sec, 50 writes/sec, and 5 global queries/sec of provisioned throughput capacity.

    Possible values: value ≥ 0

parameters

  • A number of blocks of throughput units. A block consists of 100 reads/sec, 50 writes/sec, and 5 global queries/sec of provisioned throughput capacity.

    Possible values: value ≥ 0

  • ibmcloud cloudant capacity-update --blocks 10
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT -H "Content-Type: application/json" "$SERVICE_URL/_api/v2/user/capacity/throughput" --data '{"blocks": 1}'
    
  • putCapacityThroughputConfigurationOptions := service.NewPutCapacityThroughputConfigurationOptions(
      1,
    )
    
    capacityThroughputConfiguration, response, err := service.PutCapacityThroughputConfiguration(putCapacityThroughputConfigurationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(capacityThroughputConfiguration, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.CapacityThroughputInformation;
    import com.ibm.cloud.cloudant.v1.model.PutCapacityThroughputConfigurationOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PutCapacityThroughputConfigurationOptions options =
        new PutCapacityThroughputConfigurationOptions.Builder()
            .blocks(1)
            .build();
    
    CapacityThroughputInformation response =
        service.putCapacityThroughputConfiguration(options).execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.putCapacityThroughputConfiguration({
      blocks: 1,
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.put_capacity_throughput_configuration(
      blocks=1
    ).get_result()
    
    print(response)
    

Response

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Schema for information about the currently provisioned and target throughput capacity.

Status Code

  • HTTP response for getCapacityThroughputInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example CapacityThroughputInformation response.

    {
      "current": {
        "throughput": {
          "blocks": 5,
          "query": 25,
          "read": 500,
          "write": 250
        }
      },
      "target": {
        "throughput": {
          "blocks": 10,
          "query": 50,
          "read": 1000,
          "write": 500
        }
      }
    }
  • Example CapacityThroughputInformation response.

    {
      "current": {
        "throughput": {
          "blocks": 5,
          "query": 25,
          "read": 500,
          "write": 250
        }
      },
      "target": {
        "throughput": {
          "blocks": 10,
          "query": 50,
          "read": 1000,
          "write": 500
        }
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Sets a valid account plan for the user.

Sets a valid account plan for the user. IBM Cloudant server administrators can change a user's plan across plan groups, whereas a regular IBM Cloudant user can only change between plans within the same plan group.

PUT /_api/v2/user/plan

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.userplan

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.userplan

Request

HTTP request body for putUserPlan.

Examples:
UserPlanConfiguration

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a list of all database names in the instance

GET /_all_dbs
(cloudant *CloudantV1) GetAllDbs(getAllDbsOptions *GetAllDbsOptions) (result []string, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetAllDbsWithContext(ctx context.Context, getAllDbsOptions *GetAllDbsOptions) (result []string, response *core.DetailedResponse, err error)
ServiceCall<List<String>> getAllDbs(GetAllDbsOptions getAllDbsOptions)
getAllDbs(params)
get_all_dbs(
        self,
        *,
        descending: Optional[bool] = None,
        end_key: Optional[str] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        start_key: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-all-dbs.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-all-dbs.read

Request

Instantiate the GetAllDbsOptions struct and set the fields to provide parameter values for the GetAllDbs method.

Use the GetAllDbsOptions.Builder to create a GetAllDbsOptions object that contains the parameter values for the getAllDbs method.

Query Parameters

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

WithContext method only

The GetAllDbs options.

The getAllDbs options.

parameters

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

parameters

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_all_dbs"
    
  • getAllDbsOptions := service.NewGetAllDbsOptions()
    
    result, response, err := service.GetAllDbs(getAllDbsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(result, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetAllDbsOptions;
    
    import java.util.List;
    
    Cloudant service = Cloudant.newInstance();
    
    List<String> response =
        service.getAllDbs().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getAllDbs().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_all_dbs().get_result()
    
    print(response)
    

Response

Response type: []string

Response type: List<String>

Response type: string[]

Response type: List[str]

Schema for a list of database names.

Status Code

  • HTTP response for /_all_dbs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDbs response.

    [
      "events",
      "orders",
      "products",
      "stores",
      "users"
    ]
  • Example AllDbs response.

    [
      "events",
      "orders",
      "products",
      "stores",
      "users"
    ]
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for all database names in the instance

HEAD /_all_dbs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-all-dbs.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-all-dbs.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_all_dbs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query information about multiple databases

This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.

This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.

This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.

This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.

This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.

POST /_dbs_info
(cloudant *CloudantV1) PostDbsInfo(postDbsInfoOptions *PostDbsInfoOptions) (result []DbsInfoResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostDbsInfoWithContext(ctx context.Context, postDbsInfoOptions *PostDbsInfoOptions) (result []DbsInfoResult, response *core.DetailedResponse, err error)
ServiceCall<List<DbsInfoResult>> postDbsInfo(PostDbsInfoOptions postDbsInfoOptions)
postDbsInfo(params)
post_dbs_info(
        self,
        keys: List[str],
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-dbs-info.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-dbs-info.read

Request

Instantiate the PostDbsInfoOptions struct and set the fields to provide parameter values for the PostDbsInfo method.

Use the PostDbsInfoOptions.Builder to create a PostDbsInfoOptions object that contains the parameter values for the postDbsInfo method.

HTTP request body for postDbsInfo.

Examples:
DbsInfoQuery

WithContext method only

The PostDbsInfo options.

The postDbsInfo options.

parameters

  • A list of database names.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • A list of database names.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/_dbs_info" -H "Content-Type: application/json" --data '{
      "keys":  ["products", "users", "orders"]
    }'
    
  • postDbsInfoOptions := service.NewPostDbsInfoOptions([]string{
      "products",
      "users",
      "orders",
    })
    
    dbsInfoResult, response, err := service.PostDbsInfo(postDbsInfoOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(dbsInfoResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DbsInfoResult;
    import com.ibm.cloud.cloudant.v1.model.PostDbsInfoOptions;
    
    import java.util.Arrays;
    import java.util.List;
    
    Cloudant service = Cloudant.newInstance();
    
    PostDbsInfoOptions dbsInfoOptions =
        new PostDbsInfoOptions.Builder()
            .keys(Arrays.asList("products", "users", "orders"))
            .build();
    
    List<DbsInfoResult> response =
        service.postDbsInfo(dbsInfoOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postDbsInfo({
      keys: ['products', 'users', 'orders']
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_dbs_info(
      keys=['products', 'users', 'orders']
    ).get_result()
    
    print(response)
    

Response

Response type: []DbsInfoResult

Response type: List<DbsInfoResult>

Response type: DbsInfoResult[]

Response type: List[DbsInfoResult]

Schema for a list of database information objects.

Status Code

  • HTTP response for postDbsInfo.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DbsInfoResults response.

    [
      {
        "info": {
          "cluster": {
            "n": 8,
            "q": 1,
            "r": 1,
            "w": 1
          },
          "compact_running": false,
          "db_name": "products",
          "disk_format_version": 8,
          "doc_count": 5,
          "doc_del_count": 1,
          "instance_start_time": "0",
          "partitioned_indexes": {
            "count": 4,
            "indexes": {
              "search": 2,
              "view": 2
            },
            "limit": 10
          },
          "props": {
            "partitioned": true
          },
          "purge_seq": 0,
          "sizes": {
            "active": 8887,
            "external": 1872,
            "file": 685680
          },
          "update_seq": "89-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj"
        },
        "key": "products"
      },
      {
        "info": {
          "cluster": {
            "n": 3,
            "q": 8,
            "r": 2,
            "w": 2
          },
          "compact_running": false,
          "db_name": "users",
          "disk_format_version": 8,
          "doc_count": 11,
          "doc_del_count": 0,
          "instance_start_time": "0",
          "purge_seq": "8-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj",
          "sizes": {
            "active": 67475,
            "external": 2339,
            "file": 3872387
          },
          "update_seq": "13-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj"
        },
        "key": "users"
      },
      {
        "info": {
          "cluster": {
            "n": 3,
            "q": 8,
            "r": 2,
            "w": 2
          },
          "compact_running": false,
          "db_name": "orders",
          "disk_format_version": 8,
          "doc_count": 5,
          "doc_del_count": 0,
          "instance_start_time": "0",
          "purge_seq": "8-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj",
          "sizes": {
            "active": 44475,
            "external": 1339,
            "file": 133970
          },
          "update_seq": "13-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj"
        },
        "key": "orders"
      }
    ]
  • Example DbsInfoResults response.

    [
      {
        "info": {
          "cluster": {
            "n": 8,
            "q": 1,
            "r": 1,
            "w": 1
          },
          "compact_running": false,
          "db_name": "products",
          "disk_format_version": 8,
          "doc_count": 5,
          "doc_del_count": 1,
          "instance_start_time": "0",
          "partitioned_indexes": {
            "count": 4,
            "indexes": {
              "search": 2,
              "view": 2
            },
            "limit": 10
          },
          "props": {
            "partitioned": true
          },
          "purge_seq": 0,
          "sizes": {
            "active": 8887,
            "external": 1872,
            "file": 685680
          },
          "update_seq": "89-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj"
        },
        "key": "products"
      },
      {
        "info": {
          "cluster": {
            "n": 3,
            "q": 8,
            "r": 2,
            "w": 2
          },
          "compact_running": false,
          "db_name": "users",
          "disk_format_version": 8,
          "doc_count": 11,
          "doc_del_count": 0,
          "instance_start_time": "0",
          "purge_seq": "8-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj",
          "sizes": {
            "active": 67475,
            "external": 2339,
            "file": 3872387
          },
          "update_seq": "13-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj"
        },
        "key": "users"
      },
      {
        "info": {
          "cluster": {
            "n": 3,
            "q": 8,
            "r": 2,
            "w": 2
          },
          "compact_running": false,
          "db_name": "orders",
          "disk_format_version": 8,
          "doc_count": 5,
          "doc_del_count": 0,
          "instance_start_time": "0",
          "purge_seq": "8-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj",
          "sizes": {
            "active": 44475,
            "external": 1339,
            "file": 133970
          },
          "update_seq": "13-g1AAAALReJyd0T8OgjAUBvCKjq6ewM2BQPyz6hUUeoAWSExDIDE4ewqvoNBLeAouwRmE58diQprY4PR16C9f-17KGJufpzFbxjLKL8khljs3SvNrLLLC8_zv2c2SIsVlRzC54DxUwhmyzW_WIy5XWldKTEYV9kjLPVFnSFsnEEn0Bob0LRIolErrUgk2lGuLBKrkjag1pK0TqMtm7MT53XivpRUsAEM8MSxjN5YJg5VgiDfRa-xmwVowxJHz-o9ufLhGPLRujJltrRofbhDYNGFq6gOYofZj"
        },
        "key": "orders"
      }
    ]
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete a database

Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.

Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.

Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.

Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.

Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.

DELETE /{db}
(cloudant *CloudantV1) DeleteDatabase(deleteDatabaseOptions *DeleteDatabaseOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteDatabaseWithContext(ctx context.Context, deleteDatabaseOptions *DeleteDatabaseOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> deleteDatabase(DeleteDatabaseOptions deleteDatabaseOptions)
deleteDatabase(params)
delete_database(
        self,
        db: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database.delete

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database.delete

Rate limit

This operation consumes one write request.

Request

Instantiate the DeleteDatabaseOptions struct and set the fields to provide parameter values for the DeleteDatabase method.

Use the DeleteDatabaseOptions.Builder to create a DeleteDatabaseOptions object that contains the parameter values for the deleteDatabase method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

WithContext method only

The DeleteDatabase options.

The deleteDatabase options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/$DB_NAME"
    
  • deleteDatabaseOptions := service.NewDeleteDatabaseOptions(
      "<db-name>",
    )
    
    ok, response, err := service.DeleteDatabase(deleteDatabaseOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(ok, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteDatabaseOptions;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteDatabaseOptions databaseOptions =
        new DeleteDatabaseOptions.Builder()
            .db("<db-name>")
            .build();
    
    Ok response =
        service.deleteDatabase(databaseOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.deleteDatabase({db: '<db-name>'}).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_database(db='<db-name>').get_result()
    
    print(response)
    

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about a database

GET /{db}
(cloudant *CloudantV1) GetDatabaseInformation(getDatabaseInformationOptions *GetDatabaseInformationOptions) (result *DatabaseInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDatabaseInformationWithContext(ctx context.Context, getDatabaseInformationOptions *GetDatabaseInformationOptions) (result *DatabaseInformation, response *core.DetailedResponse, err error)
ServiceCall<DatabaseInformation> getDatabaseInformation(GetDatabaseInformationOptions getDatabaseInformationOptions)
getDatabaseInformation(params)
get_database_information(
        self,
        db: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-info.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-info.read

Request

Instantiate the GetDatabaseInformationOptions struct and set the fields to provide parameter values for the GetDatabaseInformation method.

Use the GetDatabaseInformationOptions.Builder to create a GetDatabaseInformationOptions object that contains the parameter values for the getDatabaseInformation method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

WithContext method only

The GetDatabaseInformation options.

The getDatabaseInformation options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products"
    
  • getDatabaseInformationOptions := service.NewGetDatabaseInformationOptions(
      "products",
    )
    
    databaseInformation, response, err := service.GetDatabaseInformation(getDatabaseInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(databaseInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DatabaseInformation;
    import com.ibm.cloud.cloudant.v1.model.GetDatabaseInformationOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    GetDatabaseInformationOptions databaseInfoOptions =
        new GetDatabaseInformationOptions.Builder()
            .db("products")
            .build();
    
    DatabaseInformation response =
        service.getDatabaseInformation(databaseInfoOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getDatabaseInformation({db: 'products'}).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_database_information(db='products').get_result()
    
    print(response)
    

Response

Schema for information about a database.

Schema for information about a database.

Schema for information about a database.

Schema for information about a database.

Schema for information about a database.

Status Code

  • HTTP response for DatabaseInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DatabaseInformation response.

    {
      "cluster": {
        "n": 3,
        "q": 8,
        "r": 2,
        "w": 2
      },
      "compact_running": false,
      "db_name": "products",
      "disk_format_version": 8,
      "doc_count": 5,
      "doc_del_count": 1,
      "instance_start_time": "0",
      "props": {
        "partitioned": true
      },
      "purge_seq": 0,
      "sizes": {
        "active": 8887,
        "external": 1872,
        "file": 685680
      },
      "update_seq": "89-g1AAAAIjeJzLYWBg4MhgTmHQTklKzi9KdUhJMtbLzCtJTS9KLMnMzysuSS0uMTAw1EvOyS9NScwr0ctLLckBamLKYwGSDA-A1H8gyErkRDXFkBRTDkBMuY9hihEppiyAmLI_K1GQAh81QEyZn5XIRZaPkhKAZFI9tjAh0jdJDiAT4rGZQKRPkhRAJtiDTRAkyxeJDEnyEAdkAQCgLLsf",
      "partitioned_indexes": {
        "count": 4,
        "indexes": {
          "search": 2,
          "view": 2
        },
        "limit": 10
      }
    }
  • Example DatabaseInformation response.

    {
      "cluster": {
        "n": 3,
        "q": 8,
        "r": 2,
        "w": 2
      },
      "compact_running": false,
      "db_name": "products",
      "disk_format_version": 8,
      "doc_count": 5,
      "doc_del_count": 1,
      "instance_start_time": "0",
      "props": {
        "partitioned": true
      },
      "purge_seq": 0,
      "sizes": {
        "active": 8887,
        "external": 1872,
        "file": 685680
      },
      "update_seq": "89-g1AAAAIjeJzLYWBg4MhgTmHQTklKzi9KdUhJMtbLzCtJTS9KLMnMzysuSS0uMTAw1EvOyS9NScwr0ctLLckBamLKYwGSDA-A1H8gyErkRDXFkBRTDkBMuY9hihEppiyAmLI_K1GQAh81QEyZn5XIRZaPkhKAZFI9tjAh0jdJDiAT4rGZQKRPkhRAJtiDTRAkyxeJDEnyEAdkAQCgLLsf",
      "partitioned_indexes": {
        "count": 4,
        "indexes": {
          "search": 2,
          "view": 2
        },
        "limit": 10
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for a database

Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the response body is empty, using the HEAD method is a lightweight way to check if the database exists or not.

Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the response body is empty, using the HEAD method is a lightweight way to check if the database exists or not.

Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the response body is empty, using the HEAD method is a lightweight way to check if the database exists or not.

Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the response body is empty, using the HEAD method is a lightweight way to check if the database exists or not.

Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the response body is empty, using the HEAD method is a lightweight way to check if the database exists or not.

HEAD /{db}
(cloudant *CloudantV1) HeadDatabase(headDatabaseOptions *HeadDatabaseOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadDatabaseWithContext(ctx context.Context, headDatabaseOptions *HeadDatabaseOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headDatabase(HeadDatabaseOptions headDatabaseOptions)
headDatabase(params)
head_database(
        self,
        db: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-info.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-info.read

Request

Instantiate the HeadDatabaseOptions struct and set the fields to provide parameter values for the HeadDatabase method.

Use the HeadDatabaseOptions.Builder to create a HeadDatabaseOptions object that contains the parameter values for the headDatabase method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

WithContext method only

The HeadDatabase options.

The headDatabase options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/products"
    
  • headDatabaseOptions := service.NewHeadDatabaseOptions(
      "products",
    )
    
    response, err := service.HeadDatabase(headDatabaseOptions)
    if err != nil {
      panic(err)
    }
    
    fmt.Println(response.StatusCode)
    
  • import com.ibm.cloud.sdk.core.http.Headers;
    
    import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.HeadDatabaseOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    HeadDatabaseOptions databaseOptions =
        new HeadDatabaseOptions.Builder()
            .db("products")
            .build();
    
    int statusCode =
        service.headDatabase(databaseOptions).execute().getStatusCode();
    
    System.out.println(statusCode);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.headDatabase({db: 'products'}).then(response => {
      console.log(response.status);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.head_database(db='products')
    print(response.get_status_code())
    

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for DatabaseInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create a database

PUT /{db}
(cloudant *CloudantV1) PutDatabase(putDatabaseOptions *PutDatabaseOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutDatabaseWithContext(ctx context.Context, putDatabaseOptions *PutDatabaseOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> putDatabase(PutDatabaseOptions putDatabaseOptions)
putDatabase(params)
put_database(
        self,
        db: str,
        *,
        partitioned: Optional[bool] = None,
        q: Optional[int] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database.create

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database.create

Rate limit

This operation consumes one write request.

Request

Instantiate the PutDatabaseOptions struct and set the fields to provide parameter values for the PutDatabase method.

Use the PutDatabaseOptions.Builder to create a PutDatabaseOptions object that contains the parameter values for the putDatabase method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to enable database partitions when creating a database.

    Default: false

  • The number of replicas of the database in the cluster. The default is 3, unless overridden in the cluster config.

    Default: 3

  • The number of shards in the database. Each shard is a partition of the hash value range. Cloudant recommends using the default value for most databases. However, if your database is expected to be larger than 250 GB or have a lot of indexes, you may need to adjust the settings. In these cases, it's best to reach out to IBM Cloudant customer support for guidance on how to meet your specific needs and requirements.

WithContext method only

The PutDatabase options.

The putDatabase options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Query parameter to specify whether to enable database partitions when creating a database.

    Default: false

  • The number of shards in the database. Each shard is a partition of the hash value range. Cloudant recommends using the default value for most databases. However, if your database is expected to be larger than 250 GB or have a lot of indexes, you may need to adjust the settings. In these cases, it's best to reach out to IBM Cloudant customer support for guidance on how to meet your specific needs and requirements.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Query parameter to specify whether to enable database partitions when creating a database.

    Default: false

  • The number of shards in the database. Each shard is a partition of the hash value range. Cloudant recommends using the default value for most databases. However, if your database is expected to be larger than 250 GB or have a lot of indexes, you may need to adjust the settings. In these cases, it's best to reach out to IBM Cloudant customer support for guidance on how to meet your specific needs and requirements.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/products"
    
  • putDatabaseOptions := service.NewPutDatabaseOptions(
      "products",
    )
    putDatabaseOptions.SetPartitioned(true)
    
    ok, response, err := service.PutDatabase(putDatabaseOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(ok, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    import com.ibm.cloud.cloudant.v1.model.PutDatabaseOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PutDatabaseOptions databaseOptions = new PutDatabaseOptions.Builder()
        .db("products")
        .partitioned(true)
        .build();
    
    Ok response =
        service.putDatabase(databaseOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.putDatabase({
      db: 'products',
      partitioned: true
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.put_database(db='products', partitioned=True).get_result()
    
    print(response)
    

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for database creation operation.

  • HTTP response for database creation operation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query the database document changes feed (GET)

Returns a sorted list of changes made to documents in the database, in time order of application. Only the most recent change for a specific document is included in the list. For example, if you add fields to a document and then delete them, an API client that checks for changes might not know about the intermediate state of added documents. These checks listen for updates to the database for post processing or synchronization, and for practical purposes, a continuously connected _changes feed is a reasonable approach for generating a real-time log for most applications.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

GET /{db}/_changes

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Custom Headers

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify a JSON array list of document IDs to restrict the changes feed to. Used with the _doc_ids filter. Since length of URL is limited, it is better to use POST /{db}/_changes instead.

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the ID of the last events received by the server on a previous connection. Alias of Last-Event-ID header.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/orders/_changes?limit=1"
    

Response

Schema for normal changes feed result.

Status Code

  • HTTP response for /{db}/_changes style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ChangesResult response.

    {
      "last_seq": "7-g1AAAAPveJy1kk9OAjEYxSuYGBO3nsCdC9LOP5yVXkGhB-jXdoKTsSQG1p7CKyj0Ep6CS3AGob5hwYSNMJOwek3T971fXr-KMXYz6Rt2Z0hP3-2ToWygq-ncKDfjXOzPA2dnFR73FKNbKcelYoe2-H9bbZJ07_2ynPTVxRvurjTPhU6i06YcpkVH0hDk6TGEbWtOmAKBddRwUpw-iKE4ByeCxlR6v2jNCdOSPkLY1JxsxykyLlKuDLueO2OLV2dNq6-tx23dJXuR8rMtD2wj2CDfqL5m6u2Ycp1HQ5N26e4ILaIWiIL8hvDTgXcDG-RZylXDm8V5IbLkPLwodgX58n7dgRfFriHYz9DsZpqQtQWdNqn8A1TdTOE",
      "pending": 3,
      "results": [
        {
          "changes": [
            {
              "rev": "7-7a5191bfeb2f6eed6b3b6fa83f4810f5"
            }
          ],
          "deleted": true,
          "id": "0007741142412418284",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0"
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for the database document changes feed (GET)

Retrieves the HTTP headers for the database document changes feed (GET).

HEAD /{db}/_changes

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Custom Headers

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_changes style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query the database document changes feed

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

POST /{db}/_changes
(cloudant *CloudantV1) PostChanges(postChangesOptions *PostChangesOptions) (result *ChangesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostChangesWithContext(ctx context.Context, postChangesOptions *PostChangesOptions) (result *ChangesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostChangesAsStream(postChangesOptions *PostChangesOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<ChangesResult> postChanges(PostChangesOptions postChangesOptions)
ServiceCall<InputStream> postChangesAsStream(PostChangesOptions postChangesOptions)
postChanges(params)
postChangesAsStream(params)
post_changes(
        self,
        db: str,
        *,
        doc_ids: Optional[List[str]] = None,
        fields: Optional[List[str]] = None,
        selector: Optional[dict] = None,
        last_event_id: Optional[str] = None,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        feed: Optional[str] = None,
        filter: Optional[str] = None,
        heartbeat: Optional[int] = None,
        include_docs: Optional[bool] = None,
        limit: Optional[int] = None,
        seq_interval: Optional[int] = None,
        since: Optional[str] = None,
        style: Optional[str] = None,
        timeout: Optional[int] = None,
        view: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_changes_as_stream(
        self,
        db: str,
        *,
        doc_ids: Optional[List[str]] = None,
        fields: Optional[List[str]] = None,
        selector: Optional[dict] = None,
        last_event_id: Optional[str] = None,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        feed: Optional[str] = None,
        filter: Optional[str] = None,
        heartbeat: Optional[int] = None,
        include_docs: Optional[bool] = None,
        limit: Optional[int] = None,
        seq_interval: Optional[int] = None,
        since: Optional[str] = None,
        style: Optional[str] = None,
        timeout: Optional[int] = None,
        view: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Instantiate the PostChangesOptions struct and set the fields to provide parameter values for the PostChanges method.

Use the PostChangesOptions.Builder to create a PostChangesOptions object that contains the parameter values for the postChanges method.

Custom Headers

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the ID of the last events received by the server on a previous connection. Alias of Last-Event-ID header.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

HTTP request body for postChanges.

Examples:
ChangesFilterDocIds
ChangesFilterSelector

WithContext method only

The PostChanges options.

The postChanges options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/orders/_changes" -H "Content-Type: application/json" --data '{
     "doc_ids": [
     "small-appliances:1000042"
     ]
    }'
    
  • postChangesOptions := service.NewPostChangesOptions(
      "orders",
    )
    
    changesResult, response, err := service.PostChanges(postChangesOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(changesResult, "", "  ")
    fmt.Println(string(b))
    
  • postChangesOptions := service.NewPostChangesOptions(
      "orders",
    )
    
    changesResult, response, err := service.PostChangesAsStream(postChangesOptions)
    if err != nil {
      panic(err)
    }
    
    if changesResult != nil {
      defer changesResult.Close()
      outFile, err := os.Create("result.json")
      if err != nil {
        panic(err)
      }
      defer outFile.Close()
      if _, err = io.Copy(outFile, changesResult); err != nil {
        panic(err)
      }
    }
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ChangesResult;
    import com.ibm.cloud.cloudant.v1.model.PostChangesOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PostChangesOptions changesOptions = new PostChangesOptions.Builder()
        .db("orders")
        .build();
    
    ChangesResult response =
        service.postChanges(changesOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ChangesResult;
    import com.ibm.cloud.cloudant.v1.model.PostChangesOptions;
    
    import java.io.InputStream;
    import java.io.File;
    import java.nio.file.StandardCopyOption;
    
    Cloudant service = Cloudant.newInstance();
    
    PostChangesOptions changesOptions = new PostChangesOptions.Builder()
        .db("orders")
        .build();
    
    File file = new File("result.json");
    
    try (InputStream response =
            service.postChangesAsStream(changesOptions).execute()
                .getResult()) {
        java.nio.file.Files.copy(
            response,
            file.toPath(),
            StandardCopyOption.REPLACE_EXISTING);
    }
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postChanges({
      db: 'orders'
    }).then(response => {
      console.log(response.result);
    });
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postChangesAsStream({
      db: 'orders'
    }).then(response => {
      let stream = fs.createWriteStream("result.json");
      response.result.pipe(stream);
      response.result.on('end', () => stream.end());
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    response = service.post_changes(
      db='orders'
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    result = service.post_changes_as_stream(
      db='orders'
    ).get_result()
    
    with open('result.json', 'wb') as f:
      for chunk in result.iter_content():
        f.write(chunk)
    

Response

Response type for PostChanges: ChangesResult

Response type for PostChangesAsStream: io.ReadCloser

Response type for postChanges: ChangesResult

Response type for postChangesAsStream: InputStream

Response type for postChanges: ChangesResult

Response type for postChangesAsStream: NodeJS.ReadableStream

Response type for post_changes: ChangesResult

Response type for post_changes_as_stream: BinaryIO

Schema for normal changes feed result.

Schema for normal changes feed result.

Schema for normal changes feed result.

Schema for normal changes feed result.

Schema for normal changes feed result.

Status Code

  • HTTP response for /{db}/_changes style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ChangesResult response.

    {
      "last_seq": "7-g1AAAAPveJy1kk9OAjEYxSuYGBO3nsCdC9LOP5yVXkGhB-jXdoKTsSQG1p7CKyj0Ep6CS3AGob5hwYSNMJOwek3T971fXr-KMXYz6Rt2Z0hP3-2ToWygq-ncKDfjXOzPA2dnFR73FKNbKcelYoe2-H9bbZJ07_2ynPTVxRvurjTPhU6i06YcpkVH0hDk6TGEbWtOmAKBddRwUpw-iKE4ByeCxlR6v2jNCdOSPkLY1JxsxykyLlKuDLueO2OLV2dNq6-tx23dJXuR8rMtD2wj2CDfqL5m6u2Ycp1HQ5N26e4ILaIWiIL8hvDTgXcDG-RZylXDm8V5IbLkPLwodgX58n7dgRfFriHYz9DsZpqQtQWdNqn8A1TdTOE",
      "pending": 3,
      "results": [
        {
          "changes": [
            {
              "rev": "7-7a5191bfeb2f6eed6b3b6fa83f4810f5"
            }
          ],
          "deleted": true,
          "id": "0007741142412418284",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0"
        }
      ]
    }
  • Example ChangesResult response.

    {
      "last_seq": "7-g1AAAAPveJy1kk9OAjEYxSuYGBO3nsCdC9LOP5yVXkGhB-jXdoKTsSQG1p7CKyj0Ep6CS3AGob5hwYSNMJOwek3T971fXr-KMXYz6Rt2Z0hP3-2ToWygq-ncKDfjXOzPA2dnFR73FKNbKcelYoe2-H9bbZJ07_2ynPTVxRvurjTPhU6i06YcpkVH0hDk6TGEbWtOmAKBddRwUpw-iKE4ByeCxlR6v2jNCdOSPkLY1JxsxykyLlKuDLueO2OLV2dNq6-tx23dJXuR8rMtD2wj2CDfqL5m6u2Ycp1HQ5N26e4ILaIWiIL8hvDTgXcDG-RZylXDm8V5IbLkPLwodgX58n7dgRfFriHYz9DsZpqQtQWdNqn8A1TdTOE",
      "pending": 3,
      "results": [
        {
          "changes": [
            {
              "rev": "7-7a5191bfeb2f6eed6b3b6fa83f4810f5"
            }
          ],
          "deleted": true,
          "id": "0007741142412418284",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0"
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Create or modify a document in a database

Creates or modifies a document in the specified database by using the supplied JSON document.

For creation, you may specify the document ID but you should not specify the revision. If you don't specify the document ID, then the server generates an ID for your document.

For modification, you must specify the document ID and a revision identifier in the JSON document.

If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.

Creates or modifies a document in the specified database by using the supplied JSON document.

For creation, you may specify the document ID but you should not specify the revision. If you don't specify the document ID, then the server generates an ID for your document.

For modification, you must specify the document ID and a revision identifier in the JSON document.

If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.

Creates or modifies a document in the specified database by using the supplied JSON document.

For creation, you may specify the document ID but you should not specify the revision. If you don't specify the document ID, then the server generates an ID for your document.

For modification, you must specify the document ID and a revision identifier in the JSON document.

If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.

Creates or modifies a document in the specified database by using the supplied JSON document.

For creation, you may specify the document ID but you should not specify the revision. If you don't specify the document ID, then the server generates an ID for your document.

For modification, you must specify the document ID and a revision identifier in the JSON document.

If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.

Creates or modifies a document in the specified database by using the supplied JSON document.

For creation, you may specify the document ID but you should not specify the revision. If you don't specify the document ID, then the server generates an ID for your document.

For modification, you must specify the document ID and a revision identifier in the JSON document.

If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.

POST /{db}
(cloudant *CloudantV1) PostDocument(postDocumentOptions *PostDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostDocumentWithContext(ctx context.Context, postDocumentOptions *PostDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> postDocument(PostDocumentOptions postDocumentOptions)
postDocument(params)
post_document(
        self,
        db: str,
        document: Union['Document', BinaryIO],
        *,
        content_type: Optional[str] = None,
        batch: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.data-document.write

  • cloudantnosqldb.design-document.write

  • cloudantnosqldb.local-document.write

Auditing

Calling this method generates the following auditing events.

  • cloudantnosqldb.data-document.write

  • cloudantnosqldb.design-document.write

  • cloudantnosqldb.local-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PostDocumentOptions struct and set the fields to provide parameter values for the PostDocument method.

Use the PostDocumentOptions.Builder to create a PostDocumentOptions object that contains the parameter values for the postDocument method.

Custom Headers

  • Allowable values: [application/json,multipart/mixed,multipart/related]

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

HTTP request body for Document operations.

Examples:
Document

WithContext method only

The PostDocument options.

The postDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • HTTP request body for Document operations.

  • The type of the input.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

    Default: application/json

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a document.

  • The type of the input.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

    Default: application/json

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products" -H "Content-Type: application/json" --data '{
      "_id": "small-appliances:1000042",
      "type": "product",
      "productid": "1000042",
      "brand": "Salter",
      "name": "Digital Kitchen Scales",
      "description": "Slim Colourful Design Electronic Cooking Appliance for Home / Kitchen, Weigh up to 5kg + Aquatronic for Liquids ml + fl. oz. 15Yr Guarantee - Green",
      "price: 14.99,
      "image": "assets/img/0gmsnghhew.jpg"
    }'
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    productsDoc := cloudantv1.Document{
      ID: core.StringPtr("small-appliances:1000042"),
    }
    productsDoc.SetProperty("type", "product")
    productsDoc.SetProperty("productid", "1000042")
    productsDoc.SetProperty("brand", "Salter")
    productsDoc.SetProperty("name", "Digital Kitchen Scales")
    productsDoc.SetProperty("description", "Slim Colourful Design Electronic Cooking Appliance for Home / Kitchen, Weigh up to 5kg + Aquatronic for Liquids ml + fl. oz. 15Yr Guarantee - Green")
    productsDoc.SetProperty("price", 14.99)
    productsDoc.SetProperty("image", "assets/img/0gmsnghhew.jpg")
    
    postDocumentOptions := service.NewPostDocumentOptions(
      "products",
    )
    postDocumentOptions.SetDocument(&productsDoc)
    
    documentResult, response, err := service.PostDocument(postDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PostDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    Document productsDocument = new Document();
    productsDocument.setId("small-appliances:1000042");
    productsDocument.put("type", "product");
    productsDocument.put("productid", "1000042");
    productsDocument.put("brand", "Salter");
    productsDocument.put("name", "Digital Kitchen Scales");
    productsDocument.put("description", "Slim Colourful Design Electronic"
        + "Cooking Appliance for Home/Kitchen, Weigh up to 5kg + Aquatronic"
        + "for Liquids ml + fl. oz. 15Yr Guarantee - Green");
    productsDocument.put("price", 14.99);
    productsDocument.put("image", "assets/img/0gmsnghhew.jpg");
    
    PostDocumentOptions documentOptions =
        new PostDocumentOptions.Builder()
            .db("products")
            .document(productsDocument)
            .build();
    
    DocumentResult response =
        service.postDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const productsDoc: CloudantV1.Document = {
      _id: 'small-appliances:1000042',
      type: 'product',
      productid: '1000042',
      brand: 'Salter',
      name: 'Digital Kitchen Scales',
      description: 'Slim Colourful Design Electronic Cooking Appliance for Home / Kitchen, Weigh up to 5kg + Aquatronic for Liquids ml + fl. oz. 15Yr Guarantee - Green',
      price: 14.99,
      image: 'assets/img/0gmsnghhew.jpg'
    };
    
    service.postDocument({
      db: 'products',
      document: productsDoc
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import Document, CloudantV1
    
    service = CloudantV1.new_instance()
    
    products_doc = Document(
      _id="small-appliances:1000042",
      type="product",
      productid="1000042",
      brand="Salter",
      name="Digital Kitchen Scales",
      description="Slim Colourful Design Electronic Cooking Appliance for Home / Kitchen, Weigh up to 5kg + Aquatronic for Liquids ml + fl. oz. 15Yr Guarantee - Green",
      price=14.99,
      image="assets/img/0gmsnghhew.jpg")
    
    response = service.post_document(db='products', document=products_doc).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a list of all documents in a database (GET)

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

GET /{db}/_all_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/orders/_all_docs"
    

Response

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers of all documents in a database (GET)

Retrieves the HTTP headers of all documents in a database (GET).

HEAD /{db}/_all_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a list of all documents in a database

Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

POST /{db}/_all_docs
(cloudant *CloudantV1) PostAllDocs(postAllDocsOptions *PostAllDocsOptions) (result *AllDocsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostAllDocsWithContext(ctx context.Context, postAllDocsOptions *PostAllDocsOptions) (result *AllDocsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostAllDocsAsStream(postAllDocsOptions *PostAllDocsOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<AllDocsResult> postAllDocs(PostAllDocsOptions postAllDocsOptions)
ServiceCall<InputStream> postAllDocsAsStream(PostAllDocsOptions postAllDocsOptions)
postAllDocs(params)
postAllDocsAsStream(params)
post_all_docs(
        self,
        db: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[str] = None,
        key: Optional[str] = None,
        keys: Optional[List[str]] = None,
        start_key: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_all_docs_as_stream(
        self,
        db: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[str] = None,
        key: Optional[str] = None,
        keys: Optional[List[str]] = None,
        start_key: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostAllDocsOptions struct and set the fields to provide parameter values for the PostAllDocs method.

Use the PostAllDocsOptions.Builder to create a PostAllDocsOptions object that contains the parameter values for the postAllDocs method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postAllDocs and postPartitionAllDocs.

Examples:
AllDocsQuery

WithContext method only

The PostAllDocs options.

The postAllDocs options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/orders/_all_docs" -H "Content-Type: application/json" --data '{
      "include_docs": true,
      "startkey": "abc",
      "limit": 10
    }'
    
  • postAllDocsOptions := service.NewPostAllDocsOptions(
      "orders",
    )
    postAllDocsOptions.SetIncludeDocs(true)
    postAllDocsOptions.SetStartKey("abc")
    postAllDocsOptions.SetLimit(10)
    
    allDocsResult, response, err := service.PostAllDocs(postAllDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(allDocsResult, "", "  ")
    fmt.Println(string(b))
    
  • postAllDocsOptions := service.NewPostAllDocsOptions(
      "orders",
    )
    postAllDocsOptions.SetIncludeDocs(true)
    postAllDocsOptions.SetStartKey("abc")
    postAllDocsOptions.SetLimit(10)
    
    allDocsResult, response, err := service.PostAllDocsAsStream(postAllDocsOptions)
    if err != nil {
        panic(err)
    }
    
    if allDocsResult != nil {
      defer allDocsResult.Close()
      outFile, err := os.Create("result.json")
      if err != nil {
        panic(err)
      }
      defer outFile.Close()
      if _, err = io.Copy(outFile, allDocsResult); err != nil {
        panic(err)
      }
    }
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.AllDocsResult;
    import com.ibm.cloud.cloudant.v1.model.PostAllDocsOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PostAllDocsOptions docsOptions =
        new PostAllDocsOptions.Builder()
            .db("orders")
            .includeDocs(true)
            .startKey("abc")
            .limit(10)
            .build();
    
    AllDocsResult response =
        service.postAllDocs(docsOptions).execute().getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostAllDocsOptions;
    
    import java.io.InputStream;
    import java.io.File;
    import java.nio.file.StandardCopyOption;
    
    Cloudant service = Cloudant.newInstance();
    
    PostAllDocsOptions docsOptions =
        new PostAllDocsOptions.Builder()
            .db("orders")
            .includeDocs(true)
            .startKey("abc")
            .limit(10)
            .build();
    
    File file = new File("result.json");
    
    try (InputStream response =
            service.postAllDocsAsStream(docsOptions).execute()
                .getResult()) {
        java.nio.file.Files.copy(
            response,
            file.toPath(),
            StandardCopyOption.REPLACE_EXISTING);
    }
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postAllDocs({
      db: 'orders',
      includeDocs: true,
      startKey: 'abc',
      limit: 10
    }).then(response => {
      console.log(response.result);
    });
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postAllDocsAsStream({
      db: 'orders',
      includeDocs: true,
      startKey: 'abc',
      limit: 10
    }).then(response => {
      let stream = fs.createWriteStream("result.json");
      response.result.pipe(stream);
      response.result.on('end', () => stream.end());
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_all_docs(
      db='orders',
      include_docs=True,
      start_key='abc',
      limit=10
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    result = service.post_all_docs_as_stream(
      db='orders',
      include_docs=True,
      start_key='abc',
      limit=10
    ).get_result()
    
    with open('result.json', 'wb') as f:
      for chunk in result.iter_content():
        f.write(chunk)
    

Response

Response type for PostAllDocs: AllDocsResult

Response type for PostAllDocsAsStream: io.ReadCloser

Response type for postAllDocs: AllDocsResult

Response type for postAllDocsAsStream: InputStream

Response type for postAllDocs: AllDocsResult

Response type for postAllDocsAsStream: NodeJS.ReadableStream

Response type for post_all_docs: AllDocsResult

Response type for post_all_docs_as_stream: BinaryIO

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Multi-query the list of all documents in a database

Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

POST /{db}/_all_docs/queries
(cloudant *CloudantV1) PostAllDocsQueries(postAllDocsQueriesOptions *PostAllDocsQueriesOptions) (result *AllDocsQueriesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostAllDocsQueriesWithContext(ctx context.Context, postAllDocsQueriesOptions *PostAllDocsQueriesOptions) (result *AllDocsQueriesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostAllDocsQueriesAsStream(postAllDocsQueriesOptions *PostAllDocsQueriesOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<AllDocsQueriesResult> postAllDocsQueries(PostAllDocsQueriesOptions postAllDocsQueriesOptions)
ServiceCall<InputStream> postAllDocsQueriesAsStream(PostAllDocsQueriesOptions postAllDocsQueriesOptions)
postAllDocsQueries(params)
postAllDocsQueriesAsStream(params)
post_all_docs_queries(
        self,
        db: str,
        queries: List['AllDocsQuery'],
        **kwargs,
    ) -> DetailedResponse
post_all_docs_queries_as_stream(
        self,
        db: str,
        queries: List['AllDocsQuery'],
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query per query in the request.

Request

Instantiate the PostAllDocsQueriesOptions struct and set the fields to provide parameter values for the PostAllDocsQueries method.

Use the PostAllDocsQueriesOptions.Builder to create a PostAllDocsQueriesOptions object that contains the parameter values for the postAllDocsQueries method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for allDocsQueriesQuery, designDocsQueriesQuery and localDocsQueriesQuery.

Examples:
AllDocsQueriesQuery

WithContext method only

The PostAllDocsQueries options.

The postAllDocsQueries options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products/_all_docs/queries" -H "Content-Type: application/json" --data '{
      "queries": [
        {
          "keys": [
            "small-appliances:1000042",
            "small-appliances:1000043"
          ]
        },
        {
          "limit": 3,
          "skip": 2
        }
      ]
    }'
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    allDocsQueries := []cloudantv1.AllDocsQuery{
      {
        Keys: []string{
          "small-appliances:1000042",
          "small-appliances:1000043",
        },
      },
      {
        Limit: core.Int64Ptr(3),
        Skip:  core.Int64Ptr(2),
      },
    }
    postAllDocsQueriesOptions := service.NewPostAllDocsQueriesOptions(
      "products",
      allDocsQueries,
    )
    
    allDocsQueriesResult, response, err := service.PostAllDocsQueries(postAllDocsQueriesOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(allDocsQueriesResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.AllDocsQuery;
    import com.ibm.cloud.cloudant.v1.model.AllDocsQueriesResult;
    import com.ibm.cloud.cloudant.v1.model.PostAllDocsQueriesOptions;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    AllDocsQuery query1 = new AllDocsQuery.Builder()
        .keys(Arrays.asList("small-appliances:1000042",
            "small-appliances:1000043"))
        .build();
    
    AllDocsQuery query2 = new AllDocsQuery.Builder()
        .limit(3)
        .skip(2)
        .build();
    
    PostAllDocsQueriesOptions queriesOptions =
        new PostAllDocsQueriesOptions.Builder()
            .queries(Arrays.asList(query1, query2))
            .db("products")
            .build();
    
    AllDocsQueriesResult response =
        service.postAllDocsQueries(queriesOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const allDocsQueries: CloudantV1.AllDocsQuery[] = [{
        keys: ['small-appliances:1000042', 'small-appliances:1000043'],
      },
      {
        limit: 3,
        skip: 2
    }];
    
    service.postAllDocsQueries({
      db: 'products',
      queries: allDocsQueries
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import AllDocsQuery, CloudantV1
    
    service = CloudantV1.new_instance()
    
    all_docs_query1 = AllDocsQuery(
      keys=['small-appliances:1000042', 'small-appliances:1000043']
    )
    
    all_docs_query2 = AllDocsQuery(
      limit=3,
      skip=2
    )
    
    response = service.post_all_docs_queries(
      db='products',
      queries=[all_docs_query1, all_docs_query2]
    ).get_result()
    
    print(response)
    

Response

Response type for PostAllDocsQueries: AllDocsQueriesResult

Response type for PostAllDocsQueriesAsStream: io.ReadCloser

Response type for postAllDocsQueries: AllDocsQueriesResult

Response type for postAllDocsQueriesAsStream: InputStream

Response type for postAllDocsQueries: AllDocsQueriesResult

Response type for postAllDocsQueriesAsStream: NodeJS.ReadableStream

Response type for post_all_docs_queries: AllDocsQueriesResult

Response type for post_all_docs_queries_as_stream: BinaryIO

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Status Code

  • HTTP response for /_all_docs/queries style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsQueriesResult response.

    {
      "results": [
        {
          "offset": null,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        },
        {
          "offset": 2,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        }
      ]
    }
  • Example AllDocsQueriesResult response.

    {
      "results": [
        {
          "offset": null,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        },
        {
          "offset": 2,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Bulk modify multiple documents in a database

The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.

The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.

The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.

The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.

The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.

POST /{db}/_bulk_docs
(cloudant *CloudantV1) PostBulkDocs(postBulkDocsOptions *PostBulkDocsOptions) (result []DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostBulkDocsWithContext(ctx context.Context, postBulkDocsOptions *PostBulkDocsOptions) (result []DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<List<DocumentResult>> postBulkDocs(PostBulkDocsOptions postBulkDocsOptions)
postBulkDocs(params)
post_bulk_docs(
        self,
        db: str,
        bulk_docs: Union['BulkDocs', BinaryIO],
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.data-document.write

  • cloudantnosqldb.design-document.write

  • cloudantnosqldb.local-document.write

Auditing

Calling this method generates the following auditing events.

  • cloudantnosqldb.data-document.write

  • cloudantnosqldb.design-document.write

  • cloudantnosqldb.local-document.write

Rate limit

This operation consumes one write request per document revision.

Request

Instantiate the PostBulkDocsOptions struct and set the fields to provide parameter values for the PostBulkDocs method.

Use the PostBulkDocsOptions.Builder to create a PostBulkDocsOptions object that contains the parameter values for the postBulkDocs method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postBulkDocs.

Examples:
BulkDocs
BulkDocsDelete

WithContext method only

The PostBulkDocs options.

The postBulkDocs options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • HTTP request body for postBulkDocs.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for submitting documents for bulk modifications.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/events/_bulk_docs" -H "Content-Type: application/json" --data '{
      "docs": [
        {
          "_id": "0007241142412418284",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000042",
          "date": "2019-01-28T10:44:22.000Z"
        },
        {
          "_id": "0008001142412418285",
          "type": "event",
          "userid": "def456",
          "eventType": "addedToBasket",
          "productId": "1000043",
          "date": "2019-01-28T12:30:00.000Z"
        }
      ]
    }'
    
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/events/_bulk_docs" -H "Content-Type: application/json" --data '{
      "docs": [
        {
          "_id": "0007241142412418284",
          "_rev": "1-5005d65514fe9e90f8eccf174af5dd64",
          "_deleted": true
        },
        {
          "_id": "0007241142412418285",
          "_rev": "1-2d7810b054babeda4812b3924428d6d6",
          "_deleted": true
        }
      ]
    }'
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    eventDoc1 := cloudantv1.Document{
      ID: core.StringPtr("0007241142412418284"),
    }
    eventDoc1.SetProperty("type", "event")
    eventDoc1.SetProperty("userid", "abc123")
    eventDoc1.SetProperty("eventType", "addedToBasket")
    eventDoc1.SetProperty("productId", "1000042")
    eventDoc1.SetProperty("date", "2019-01-28T10:44:22.000Z")
    
    eventDoc2 := cloudantv1.Document{
      ID: core.StringPtr("0007241142412418285"),
    }
    eventDoc2.SetProperty("type", "event")
    eventDoc2.SetProperty("userid", "abc234")
    eventDoc2.SetProperty("eventType", "addedToBasket")
    eventDoc2.SetProperty("productId", "1000050")
    eventDoc2.SetProperty("date", "2019-01-25T20:00:00.000Z")
    
    postBulkDocsOptions := service.NewPostBulkDocsOptions(
      "events",
    )
    bulkDocs, err := service.NewBulkDocs(
      []cloudantv1.Document{
        eventDoc1,
        eventDoc2,
      },
    )
    if err != nil {
      panic(err)
    }
    
    postBulkDocsOptions.SetBulkDocs(bulkDocs)
    
    documentResult, response, err := service.PostBulkDocs(postBulkDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    eventDoc1 := cloudantv1.Document{
      ID: core.StringPtr("0007241142412418284"),
    }
    eventDoc1.Rev = core.StringPtr("1-5005d65514fe9e90f8eccf174af5dd64")
    eventDoc1.Deleted = core.BoolPtr(true)
    
    eventDoc2 := cloudantv1.Document{
      ID: core.StringPtr("0007241142412418285"),
    }
    eventDoc2.Rev = core.StringPtr("1-2d7810b054babeda4812b3924428d6d6")
    eventDoc2.Deleted = core.BoolPtr(true)
    
    postBulkDocsOptions := service.NewPostBulkDocsOptions(
      "events",
    )
    bulkDocs, err := service.NewBulkDocs(
      []cloudantv1.Document{
        eventDoc1,
        eventDoc2,
      },
    )
    if err != nil {
      panic(err)
    }
    
    postBulkDocsOptions.SetBulkDocs(bulkDocs)
    
    documentResult, response, err := service.PostBulkDocs(postBulkDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • file, err := os.Open("upload.json")
    if err != nil {
      panic(err)
    }
    
    postBulkDocsOptions := service.NewPostBulkDocsOptions(
      "events",
    )
    
    postBulkDocsOptions.SetBody(file)
    
    documentResult, response, err := service.PostBulkDocs(postBulkDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    

    Content of upload.json

    {
      "docs": [
        {
          "_id": "0007241142412418284",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000042",
          "date": "2019-01-28T10:44:22.000Z"
        },
        {
          "_id": "0007241142412418285",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000050",
          "date": "2019-01-25T20:00:00.000Z"
        }
      ]
    }
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.BulkDocs;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PostBulkDocsOptions;
    
    import java.util.Arrays;
    import java.util.List;
    
    Cloudant service = Cloudant.newInstance();
    
    Document eventDoc1 = new Document();
    eventDoc1.setId("0007241142412418284");
    eventDoc1.put("type", "event");
    eventDoc1.put("userid", "abc123");
    eventDoc1.put("eventType", "addedToBasket");
    eventDoc1.put("productId", "1000042");
    eventDoc1.put("date", "2019-01-28T10:44:22.000Z");
    
    Document eventDoc2 = new Document();
    eventDoc2.setId("0007241142412418285");
    eventDoc2.put("type", "event");
    eventDoc2.put("userid", "abc234");
    eventDoc2.put("eventType", "addedToBasket");
    eventDoc2.put("productId", "1000050");
    eventDoc2.put("date", "2019-01-28T10:44:22.000Z");
    
    BulkDocs bulkDocs = new BulkDocs.Builder()
        .docs(Arrays.asList(eventDoc1, eventDoc2))
        .build();
    
    PostBulkDocsOptions bulkDocsOptions = new PostBulkDocsOptions.Builder()
        .db("events")
        .bulkDocs(bulkDocs)
        .build();
    
    List<DocumentResult> response =
        service.postBulkDocs(bulkDocsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.BulkDocs;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PostBulkDocsOptions;
    
    import java.util.Arrays;
    import java.util.List;
    
    Cloudant service = Cloudant.newInstance();
    
    Document eventDoc1 = new Document();
    eventDoc1.setId("0007241142412418284");
    eventDoc1.setRev("1-5005d65514fe9e90f8eccf174af5dd64");
    eventDoc1.setDeleted(true);
    
    Document eventDoc2 = new Document();
    eventDoc2.setId("0007241142412418285");
    eventDoc1.setRev("1-2d7810b054babeda4812b3924428d6d6");
    eventDoc1.setDeleted(true);
    
    BulkDocs bulkDocs = new BulkDocs.Builder()
        .docs(Arrays.asList(eventDoc1, eventDoc2))
        .build();
    
    PostBulkDocsOptions bulkDocsOptions = new PostBulkDocsOptions.Builder()
        .db("events")
        .bulkDocs(bulkDocs)
        .build();
    
    List<DocumentResult> response =
        service.postBulkDocs(bulkDocsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PostBulkDocsOptions;
    
    import java.util.List;
    import java.io.File;
    import java.io.FileInputStream;
    
    Cloudant service = Cloudant.newInstance();
    
    File file = new File("upload.json");
    FileInputStream inputStream = new FileInputStream(file);
    
    PostBulkDocsOptions bulkDocsOptions = new PostBulkDocsOptions.Builder()
        .db("events")
        .body(inputStream)
        .build();
    
    List<DocumentResult> response =
        service.postBulkDocs(bulkDocsOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    Content of upload.json

    {
      "docs": [
        {
          "_id": "0007241142412418284",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000042",
          "date": "2019-01-28T10:44:22.000Z"
        },
        {
          "_id": "0007241142412418285",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000050",
          "date": "2019-01-25T20:00:00.000Z"
        }
      ]
    }
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const eventDoc1: CloudantV1.Document = {
      _id: '0007241142412418284',
      type: 'event',
      userid: 'abc123',
      eventType:'addedToBasket',
      productId: '1000042',
      date: '2019-01-28T10:44:22.000Z'
    }
    const eventDoc2: CloudantV1.Document = {
      _id: '0007241142412418285',
      type: 'event',
      userid: 'abc234',
      eventType: 'addedToBasket',
      productId: '1000050',
      date: '2019-01-25T20:00:00.000Z'
    }
    
    const bulkDocs: CloudantV1.BulkDocs = {  docs: [eventDoc1, eventDoc2]
    }
    
    service.postBulkDocs({
      db: 'events',
      bulkDocs: bulkDocs
    }).then(response => {
      console.log(response.result);
    });
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const eventDoc1: CloudantV1.Document = {
      _id: '0007241142412418284',
      _rev: '1-5005d65514fe9e90f8eccf174af5dd64',
      _deleted: true,
    }
    const eventDoc2: CloudantV1.Document = {
      _id: '0007241142412418285',
      _rev: '1-2d7810b054babeda4812b3924428d6d6',
      _deleted: true,
    }
    
    const bulkDocs: CloudantV1.BulkDocs = {  docs: [eventDoc1, eventDoc2]
    }
    
    service.postBulkDocs({
      db: 'events',
      bulkDocs: bulkDocs
    }).then(response => {
      console.log(response.result);
    });
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    let stream = fs.createReadStream("upload.json");
    
    service.postBulkDocs({
      db: 'events',
      bulkDocs: stream
    }).then(response => {
      console.log(response.result);
    });
    

    Content of upload.json

    {
      "docs": [
        {
          "_id": "0007241142412418284",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000042",
          "date": "2019-01-28T10:44:22.000Z"
        },
        {
          "_id": "0007241142412418285",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000050",
          "date": "2019-01-25T20:00:00.000Z"
        }
      ]
    }
    
  • from ibmcloudant.cloudant_v1 import Document, CloudantV1, BulkDocs
    
    service = CloudantV1.new_instance()
    
    event_doc_1 = Document(
      _id="0007241142412418284",
      type="event",
      userid="abc123",
      eventType="addedToBasket",
      productId="1000042",
      date="2019-01-28T10:44:22.000Z"
    )
    event_doc_2 = Document(
      _id="0007241142412418285",
      type="event",
      userid="abc234",
      eventType="addedToBasket",
      productId="1000050",
      date="2019-01-25T20:00:00.000Z"
    )
    
    bulk_docs = BulkDocs(docs=[event_doc_1, event_doc_2])
    
    response = service.post_bulk_docs(
      db='events',
      bulk_docs=bulk_docs
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import Document, CloudantV1, BulkDocs
    
    service = CloudantV1.new_instance()
    
    event_doc_1 = Document(
      _id="0007241142412418284",
      _rev="1-5005d65514fe9e90f8eccf174af5dd64",
      _deleted=True,
    )
    event_doc_2 = Document(
      _id="0007241142412418285",
      _rev="1-2d7810b054babeda4812b3924428d6d6",
      _deleted=True,
    )
    
    bulk_docs = BulkDocs(docs=[event_doc_1, event_doc_2])
    
    response = service.post_bulk_docs(
      db='events',
      bulk_docs=bulk_docs
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import Document, CloudantV1
    
    service = CloudantV1.new_instance()
    
    with open('upload.json', 'rb') as f:
      response = service.post_bulk_docs(
        db='events',
        bulk_docs=f
      ).get_result()
    
    print(response)
    

    Content of upload.json

    {
      "docs": [
        {
          "_id": "0007241142412418284",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000042",
          "date": "2019-01-28T10:44:22.000Z"
        },
        {
          "_id": "0007241142412418285",
          "type": "event",
          "userid": "abc123",
          "eventType": "addedToBasket",
          "productId": "1000050",
          "date": "2019-01-25T20:00:00.000Z"
        }
      ]
    }
    

Response

Response type: []DocumentResult

Response type: List<DocumentResult>

Response type: DocumentResult[]

Response type: List[DocumentResult]

Schema for a list of response statuses for each document in a bulk documents operation.

Status Code

  • HTTP response for postBulkDocs.

  • HTTP response for postBulkDocs.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example BulkDocsResult response.

    [
      {
        "id": "0007241142412418284",
        "ok": true,
        "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
      },
      {
        "id": "0008001142412418285",
        "ok": true,
        "rev": "1-2d7810b054babeda4812b3924428d6d6"
      }
    ]
  • Example BulkDocsResult response.

    [
      {
        "id": "0007241142412418284",
        "ok": true,
        "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
      },
      {
        "id": "0008001142412418285",
        "ok": true,
        "rev": "1-2d7810b054babeda4812b3924428d6d6"
      }
    ]
  • Example BulkDocsResult response.

    [
      {
        "id": "0007241142412418284",
        "ok": true,
        "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
      },
      {
        "id": "0008001142412418285",
        "ok": true,
        "rev": "1-2d7810b054babeda4812b3924428d6d6"
      }
    ]
  • Example BulkDocsResult response.

    [
      {
        "id": "0007241142412418284",
        "ok": true,
        "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
      },
      {
        "id": "0008001142412418285",
        "ok": true,
        "rev": "1-2d7810b054babeda4812b3924428d6d6"
      }
    ]
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Bulk query revision information for multiple documents

Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

POST /{db}/_bulk_get
(cloudant *CloudantV1) PostBulkGet(postBulkGetOptions *PostBulkGetOptions) (result *BulkGetResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostBulkGetWithContext(ctx context.Context, postBulkGetOptions *PostBulkGetOptions) (result *BulkGetResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostBulkGetAsMixed(postBulkGetOptions *PostBulkGetOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostBulkGetAsRelated(postBulkGetOptions *PostBulkGetOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostBulkGetAsStream(postBulkGetOptions *PostBulkGetOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<BulkGetResult> postBulkGet(PostBulkGetOptions postBulkGetOptions)
ServiceCall<InputStream> postBulkGetAsMixed(PostBulkGetOptions postBulkGetOptions)
ServiceCall<InputStream> postBulkGetAsRelated(PostBulkGetOptions postBulkGetOptions)
ServiceCall<InputStream> postBulkGetAsStream(PostBulkGetOptions postBulkGetOptions)
postBulkGet(params)
postBulkGetAsMixed(params)
postBulkGetAsRelated(params)
postBulkGetAsStream(params)
post_bulk_get(
        self,
        db: str,
        docs: List['BulkGetQueryDocument'],
        *,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        latest: Optional[bool] = None,
        revs: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse
post_bulk_get_as_mixed(
        self,
        db: str,
        docs: List['BulkGetQueryDocument'],
        *,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        latest: Optional[bool] = None,
        revs: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse
post_bulk_get_as_related(
        self,
        db: str,
        docs: List['BulkGetQueryDocument'],
        *,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        latest: Optional[bool] = None,
        revs: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse
post_bulk_get_as_stream(
        self,
        db: str,
        docs: List['BulkGetQueryDocument'],
        *,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        latest: Optional[bool] = None,
        revs: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request per document revision.

Request

Instantiate the PostBulkGetOptions struct and set the fields to provide parameter values for the PostBulkGet method.

Use the PostBulkGetOptions.Builder to create a PostBulkGetOptions object that contains the parameter values for the postBulkGet method.

Custom Headers

  • Allowable values: [application/json,multipart/mixed,multipart/related]

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

HTTP request body for postBulkGet.

Examples:
BulkGetQuery

WithContext method only

The PostBulkGet options.

The postBulkGet options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • List of document items to get in bulk.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • List of document items to get in bulk.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/orders/_bulk_get" -H "Content-Type: application/json" --data '{
      "docs": [
        {
          "id": "order00067",
          "rev": "3-917fa2381192822767f010b95b45325b"
        },
        {
          "id": "order00067"
          "rev": "4-a5be949eeb7296747cc271766e9a498b"
        }
      ],
    }'
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    docID := "order00067"
    
    bulkGetDocs := []cloudantv1.BulkGetQueryDocument{
      {
        ID: &docID,
        Rev: core.StringPtr("3-917fa2381192822767f010b95b45325b"),
      },
      {
        ID: &docID,
        Rev: core.StringPtr("4-a5be949eeb7296747cc271766e9a498b"),
      },
    }
    
    postBulkGetOptions := service.NewPostBulkGetOptions(
      "orders",
      bulkGetDocs,
    )
    bulkGetResult, response, err := service.PostBulkGet(postBulkGetOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(bulkGetResult, "", "  ")
    fmt.Println(string(b))
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    postBulkGetOptions := service.NewPostBulkGetOptions(
      "orders",
      []cloudantv1.BulkGetQueryDocument{{ID: core.StringPtr("order00067")}},
    )
    
    bulkGetResult, response, err := service.PostBulkGet(postBulkGetOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(bulkGetResult, "", "  ")
    fmt.Println(string(b))
    
  • docID := "order00058"
    
    postBulkGetOptions := service.NewPostBulkGetOptions(
      "orders",
      []cloudantv1.BulkGetQueryDocument{
        {
          ID: &docID,
          AttsSince: []string{"1-99b02e08da151943c2dcb40090160bb8"},
        },
      },
    )
    
    bulkGetResult, response, err := service.PostBulkGet(postBulkGetOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(bulkGetResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.BulkGetQueryDocument;
    import com.ibm.cloud.cloudant.v1.model.BulkGetResult;
    import com.ibm.cloud.cloudant.v1.model.PostBulkGetOptions;
    
    import java.util.ArrayList;
    import java.util.List;
    
    Cloudant service = Cloudant.newInstance();
    
    String docId = "order00067";
    List<BulkGetQueryDocument> bulkGetDocs = new ArrayList<>();
    
    bulkGetDocs.add(
        new BulkGetQueryDocument.Builder()
            .id(docId)
            .rev("3-917fa2381192822767f010b95b45325b")
            .build());
    bulkGetDocs.add(
        new BulkGetQueryDocument.Builder()
            .id(docId)
            .rev("4-a5be949eeb7296747cc271766e9a498b")
            .build());
    
    PostBulkGetOptions bulkGetOptions = new PostBulkGetOptions.Builder()
        .db("orders")
        .docs(bulkGetDocs)
        .build();
    
    BulkGetResult response =
        service.postBulkGet(bulkGetOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.BulkGetQueryDocument;
    import com.ibm.cloud.cloudant.v1.model.BulkGetResult;
    import com.ibm.cloud.cloudant.v1.model.PostBulkGetOptions;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    BulkGetQueryDocument bulkGetDoc =
        new BulkGetQueryDocument.Builder()
            .id("order00067")
            .build();
    
    PostBulkGetOptions postBulkGetOptions =
        new PostBulkGetOptions.Builder()
            .db("orders")
            .docs(Arrays.asList(bulkGetDoc))
            .build();
    
    BulkGetResult response =
        service.postBulkGet(postBulkGetOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.BulkGetQueryDocument;
    import com.ibm.cloud.cloudant.v1.model.BulkGetResult;
    import com.ibm.cloud.cloudant.v1.model.PostBulkGetOptions;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    BulkGetQueryDocument bulkGetQueryDocument =
        new BulkGetQueryDocument.Builder()
            .id("order00058")
            .addAttsSince("1-99b02e08da151943c2dcb40090160bb8")
            .build();
    
    PostBulkGetOptions postBulkGetOptions =
        new PostBulkGetOptions.Builder()
            .db("orders")
            .docs(Arrays.asList(bulkGetQueryDocument)).build();
    
    BulkGetResult response =
        service.postBulkGet(postBulkGetOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • const service = CloudantV1.newInstance({});
    
    const docId = 'order00067';
    
    const bulkGetDoc1: CloudantV1.BulkGetQueryDocument = {
      id: docId,
      rev: '3-917fa2381192822767f010b95b45325b'
    };
    const bulkGetDoc2: CloudantV1.BulkGetQueryDocument = {
      id: docId,
      rev: '4-a5be949eeb7296747cc271766e9a498b'
    };
    
    const bulkGetDocs: CloudantV1.BulkGetQueryDocument[] = [bulkGetDoc1, bulkGetDoc2];
    
    const postBulkGetParams: CloudantV1.PostBulkGetParams = {
      db: 'orders',
      docs: bulkGetDocs,
    };
    
    service.postBulkGet(postBulkGetParams)
      .then(response => {
        console.log(response.result);
      });
    
  • const service = CloudantV1.newInstance({});
    
    const bulkGetDocs: CloudantV1.BulkGetQueryDocument[] = [
      {
        id: 'order00067',
      },
    ];
    
    const postBulkGetParams: CloudantV1.PostBulkGetParams = {
      db: 'orders',
      docs: bulkGetDocs,
    };
    
    service.postBulkGet(postBulkGetParams)
      .then(response => {
        console.log(response.result);
    });
    
  • const service = CloudantV1.newInstance({});
    
    const bulkGetQueryDocuments: CloudantV1.BulkGetQueryDocument[] = [
      {
        id: 'order00058',
        attsSince: ['1-99b02e08da151943c2dcb40090160bb8']
      },
    ];
    
    const postBulkGetParams: CloudantV1.PostBulkGetParams = {
      db: 'orders',
      docs: bulkGetQueryDocuments,
    };
    
    service.postBulkGet(postBulkGetParams)
      .then(response => {
        console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import BulkGetQueryDocument, CloudantV1
    
    service = CloudantV1.new_instance()
    
    doc_id = 'order00067'
    bulk_get_doc_1 = BulkGetQueryDocument(
        id=doc_id,
        rev='3-917fa2381192822767f010b95b45325b')
    bulk_get_doc_2 = BulkGetQueryDocument(
        id=doc_id,
        rev='4-a5be949eeb7296747cc271766e9a498b')
    
    response = service.post_bulk_get(
        db='orders',
        docs=[bulk_get_doc_1, bulk_get_doc_2],
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import BulkGetQueryDocument, CloudantV1
    
    service = CloudantV1.new_instance()
    
    bulk_get_doc = BulkGetQueryDocument(id='order00067')
    response = service.post_bulk_get(
        db='orders',
        docs=[bulk_get_doc],
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import BulkGetQueryDocument, CloudantV1
    
    service = CloudantV1.new_instance()
    
    bulk_get_doc = BulkGetQueryDocument(
        id='order00058',
        atts_since=['1-99b02e08da151943c2dcb40090160bb8'])
    response = service.post_bulk_get(
        db='orders',
        docs=[bulk_get_doc]
    ).get_result()
    
    print(response)
    

Response

Response type for PostBulkGet: BulkGetResult

Response type for PostBulkGetAsMixed: io.ReadCloser

Response type for PostBulkGetAsRelated: io.ReadCloser

Response type for PostBulkGetAsStream: io.ReadCloser

Response type for postBulkGet: BulkGetResult

Response type for postBulkGetAsMixed: InputStream

Response type for postBulkGetAsRelated: InputStream

Response type for postBulkGetAsStream: InputStream

Response type for postBulkGet: BulkGetResult

Response type for postBulkGetAsMixed: NodeJS.ReadableStream

Response type for postBulkGetAsRelated: NodeJS.ReadableStream

Response type for postBulkGetAsStream: NodeJS.ReadableStream

Response type for post_bulk_get: BulkGetResult

Response type for post_bulk_get_as_mixed: BinaryIO

Response type for post_bulk_get_as_related: BinaryIO

Response type for post_bulk_get_as_stream: BinaryIO

Schema for the results object of a bulk get operation.

Schema for the results object of a bulk get operation.

Schema for the results object of a bulk get operation.

Schema for the results object of a bulk get operation.

Schema for the results object of a bulk get operation.

Status Code

  • HTTP response for postBulkGet.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example BulkGetResult response.

    {
      "results": [
        {
          "docs": [
            {
              "ok": {
                "_id": "order00067",
                "_rev": "3-917fa2381192822767f010b95b45325b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  }
                ],
                "date": "2019-01-21T10:10:12.000Z",
                "delivered": false,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 14.99,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            }
          ],
          "id": "order00067"
        },
        {
          "docs": [
            {
              "ok": {
                "_id": "order00067",
                "_rev": "4-a5be949eeb7296747cc271766e9a498b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  },
                  {
                    "name": "Kenwood - Stand Mixer",
                    "price": 199.99
                  }
                ],
                "courier": "UPS",
                "courierid": "15125425151261289",
                "date": "2019-01-28T10:44:22.000Z",
                "delivered": true,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 214.98,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            }
          ],
          "id": "order00067"
        }
      ]
    }
  • Example BulkGetResult response.

    {
      "results": [
        {
          "docs": [
            {
              "ok": {
                "_id": "order00067",
                "_rev": "3-917fa2381192822767f010b95b45325b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  }
                ],
                "date": "2019-01-21T10:10:12.000Z",
                "delivered": false,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 14.99,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            }
          ],
          "id": "order00067"
        },
        {
          "docs": [
            {
              "ok": {
                "_id": "order00067",
                "_rev": "4-a5be949eeb7296747cc271766e9a498b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  },
                  {
                    "name": "Kenwood - Stand Mixer",
                    "price": 199.99
                  }
                ],
                "courier": "UPS",
                "courierid": "15125425151261289",
                "date": "2019-01-28T10:44:22.000Z",
                "delivered": true,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 214.98,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            }
          ],
          "id": "order00067"
        }
      ]
    }
  • Example BulkGetResult response for the atts_since alternative request.

    {
      "results": [
        {
          "docs": [
            {
              "ok": {
                "_attachments": {
                  "att": {
                    "content-type": "application/json",
                    "digest": "md5-cCkGbCesb17xjWYNV0GXmg==",
                    "length": 0,
                    "revpos": 1,
                    "stub": true
                  }
                },
                "_id": "order00058",
                "_rev": "1-99b02e08da151943c2dcb40090160bb8"
              }
            }
          ],
          "id": "order00058"
        }
      ]
    }
  • Example BulkGetResult response for the atts_since alternative request.

    {
      "results": [
        {
          "docs": [
            {
              "ok": {
                "_attachments": {
                  "att": {
                    "content-type": "application/json",
                    "digest": "md5-cCkGbCesb17xjWYNV0GXmg==",
                    "length": 0,
                    "revpos": 1,
                    "stub": true
                  }
                },
                "_id": "order00058",
                "_rev": "1-99b02e08da151943c2dcb40090160bb8"
              }
            }
          ],
          "id": "order00058"
        }
      ]
    }
  • Example BulkGetResult response for the open_revs=all alternative request.

    {
      "results": [
        {
          "id": "order00067"
        },
        {
          "docs": [
            {
              "ok": {
                "_id": "order00067",
                "_rev": "3-917fa2381192822767f010b95b45325b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  }
                ],
                "date": "2019-01-21T10:10:12.000Z",
                "delivered": false,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 14.99,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            },
            {
              "ok": {
                "_id": "order00067",
                "_rev": "4-a5be949eeb7296747cc271766e9a498b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  },
                  {
                    "name": "Kenwood - Stand Mixer",
                    "price": 199.99
                  }
                ],
                "courier": "UPS",
                "courierid": "15125425151261289",
                "date": "2019-01-28T10:44:22.000Z",
                "delivered": true,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 214.98,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            }
          ]
        }
      ]
    }
  • Example BulkGetResult response for the open_revs=all alternative request.

    {
      "results": [
        {
          "id": "order00067"
        },
        {
          "docs": [
            {
              "ok": {
                "_id": "order00067",
                "_rev": "3-917fa2381192822767f010b95b45325b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  }
                ],
                "date": "2019-01-21T10:10:12.000Z",
                "delivered": false,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 14.99,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            },
            {
              "ok": {
                "_id": "order00067",
                "_rev": "4-a5be949eeb7296747cc271766e9a498b",
                "basket": [
                  {
                    "name": "Salter - Digital Kitchen Scales",
                    "price": 14.99
                  },
                  {
                    "name": "Kenwood - Stand Mixer",
                    "price": 199.99
                  }
                ],
                "courier": "UPS",
                "courierid": "15125425151261289",
                "date": "2019-01-28T10:44:22.000Z",
                "delivered": true,
                "deliveryAddress": {
                  "postcode": "DL5 1TY",
                  "street": "19 Front St",
                  "town": "Darlington"
                },
                "orderid": "00067",
                "total": 214.98,
                "type": "order",
                "user": "Bob Smith",
                "userid": "abc123"
              }
            }
          ]
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a list of all documents in a database partition (GET)

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

GET /{db}/_partition/{partition_key}/_all_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances/_all_docs?include_docs=true"
    

Response

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a list of all documents in a database partition (GET)

Retrieves the HTTP headers for a list of all documents in a database partition (GET).

HEAD /{db}/_partition/{partition_key}/_all_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Delete a document

Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

DELETE /{db}/{doc_id}
(cloudant *CloudantV1) DeleteDocument(deleteDocumentOptions *DeleteDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteDocumentWithContext(ctx context.Context, deleteDocumentOptions *DeleteDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> deleteDocument(DeleteDocumentOptions deleteDocumentOptions)
deleteDocument(params)
delete_document(
        self,
        db: str,
        doc_id: str,
        *,
        if_match: Optional[str] = None,
        batch: Optional[str] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.data-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.data-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the DeleteDocumentOptions struct and set the fields to provide parameter values for the DeleteDocument method.

Use the DeleteDocumentOptions.Builder to create a DeleteDocumentOptions object that contains the parameter values for the deleteDocument method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

WithContext method only

The DeleteDocument options.

The deleteDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/events/0007241142412418284?rev=2-9a0d1cd9f40472509e9aac6461837367"
    
  • deleteDocumentOptions := service.NewDeleteDocumentOptions(
      "events",
      "0007241142412418284",
    )
    deleteDocumentOptions.SetRev("2-9a0d1cd9f40472509e9aac6461837367")
    
    documentResult, response, err := service.DeleteDocument(deleteDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteDocumentOptions documentOptions =
        new DeleteDocumentOptions.Builder()
            .db("events")
            .docId("0007241142412418284")
            .rev("2-9a0d1cd9f40472509e9aac6461837367")
            .build();
    
    DocumentResult response =
        service.deleteDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    const service = CloudantV1.newInstance({});
    
    service.deleteDocument({
      db: 'events',
      docId: '0007241142412418284',
      rev: '2-9a0d1cd9f40472509e9aac6461837367'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_document(
      db='events',
      doc_id='0007241142412418284',
      rev='2-9a0d1cd9f40472509e9aac6461837367'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve a document

Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

GET /{db}/{doc_id}
(cloudant *CloudantV1) GetDocument(getDocumentOptions *GetDocumentOptions) (result *Document, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDocumentWithContext(ctx context.Context, getDocumentOptions *GetDocumentOptions) (result *Document, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDocumentAsMixed(getDocumentOptions *GetDocumentOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDocumentAsRelated(getDocumentOptions *GetDocumentOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDocumentAsStream(getDocumentOptions *GetDocumentOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<Document> getDocument(GetDocumentOptions getDocumentOptions)
ServiceCall<InputStream> getDocumentAsMixed(GetDocumentOptions getDocumentOptions)
ServiceCall<InputStream> getDocumentAsRelated(GetDocumentOptions getDocumentOptions)
ServiceCall<InputStream> getDocumentAsStream(GetDocumentOptions getDocumentOptions)
getDocument(params)
getDocumentAsMixed(params)
getDocumentAsRelated(params)
getDocumentAsStream(params)
get_document(
        self,
        db: str,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        deleted_conflicts: Optional[bool] = None,
        latest: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        meta: Optional[bool] = None,
        rev: Optional[str] = None,
        revs: Optional[bool] = None,
        revs_info: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse
get_document_as_mixed(
        self,
        db: str,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        deleted_conflicts: Optional[bool] = None,
        latest: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        meta: Optional[bool] = None,
        rev: Optional[str] = None,
        revs: Optional[bool] = None,
        revs_info: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse
get_document_as_related(
        self,
        db: str,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        deleted_conflicts: Optional[bool] = None,
        latest: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        meta: Optional[bool] = None,
        rev: Optional[str] = None,
        revs: Optional[bool] = None,
        revs_info: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse
get_document_as_stream(
        self,
        db: str,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        deleted_conflicts: Optional[bool] = None,
        latest: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        meta: Optional[bool] = None,
        rev: Optional[str] = None,
        revs: Optional[bool] = None,
        revs_info: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetDocumentOptions struct and set the fields to provide parameter values for the GetDocument method.

Use the GetDocumentOptions.Builder to create a GetDocumentOptions object that contains the parameter values for the getDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

  • Allowable values: [application/json,multipart/mixed,multipart/related]

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments only since specified revisions. Note this does not include the attachments for the specified revisions.

    Examples:
    View
  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify leaf revisions to retrieve. Additionally, it accepts a value of all to return all leaf revisions.

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

WithContext method only

The GetDocument options.

The getDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/small-appliances:1000042"
    
  • getDocumentOptions := service.NewGetDocumentOptions(
      "products",
      "small-appliances:1000042",
    )
    
    document, response, err := service.GetDocument(getDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(document, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.GetDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    GetDocumentOptions documentOptions =
        new GetDocumentOptions.Builder()
            .db("products")
            .docId("small-appliances:1000042")
            .build();
    
    Document response =
        service.getDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getDocument({
      db: 'products',
      docId: 'small-appliances:1000042'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_document(
      db='products',
      doc_id='small-appliances:1000042'
    ).get_result()
    
    print(response)
    

Response

Response type for GetDocument: Document

Response type for GetDocumentAsMixed: io.ReadCloser

Response type for GetDocumentAsRelated: io.ReadCloser

Response type for GetDocumentAsStream: io.ReadCloser

Response type for getDocument: Document

Response type for getDocumentAsMixed: InputStream

Response type for getDocumentAsRelated: InputStream

Response type for getDocumentAsStream: InputStream

Response type for getDocument: Document

Response type for getDocumentAsMixed: NodeJS.ReadableStream

Response type for getDocumentAsRelated: NodeJS.ReadableStream

Response type for getDocumentAsStream: NodeJS.ReadableStream

Response type for get_document: Document

Response type for get_document_as_mixed: BinaryIO

Response type for get_document_as_related: BinaryIO

Response type for get_document_as_stream: BinaryIO

Schema for a document.

Schema for a document.

Schema for a document.

Schema for a document.

Schema for a document.

Status Code

  • HTTP response for Document.

  • Document wasn't modified since specified revision.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Document.

    {
      "_id": "exampleid",
      "brand": "Foo",
      "colours": [
        "red",
        "green",
        "black",
        "blue"
      ],
      "description": "Slim Colourful Design Electronic Cooking Appliance for ...",
      "image": "assets/img/0gmsnghhew.jpg",
      "keywords": [
        "Foo",
        "Scales",
        "Weight",
        "Digital",
        "Kitchen"
      ],
      "name": "Digital Kitchen Scales",
      "price": 14.99,
      "productid": "1000042",
      "taxonomy": [
        "Home",
        "Kitchen",
        "Small Appliances"
      ],
      "type": "product"
    }
  • Example Document.

    {
      "_id": "exampleid",
      "brand": "Foo",
      "colours": [
        "red",
        "green",
        "black",
        "blue"
      ],
      "description": "Slim Colourful Design Electronic Cooking Appliance for ...",
      "image": "assets/img/0gmsnghhew.jpg",
      "keywords": [
        "Foo",
        "Scales",
        "Weight",
        "Digital",
        "Kitchen"
      ],
      "name": "Digital Kitchen Scales",
      "price": 14.99,
      "productid": "1000042",
      "taxonomy": [
        "Home",
        "Kitchen",
        "Small Appliances"
      ],
      "type": "product"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for the document

This method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data if the document was requested in full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned.

This method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data if the document was requested in full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned.

This method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data if the document was requested in full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned.

This method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data if the document was requested in full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned.

This method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data if the document was requested in full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned.

HEAD /{db}/{doc_id}
(cloudant *CloudantV1) HeadDocument(headDocumentOptions *HeadDocumentOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadDocumentWithContext(ctx context.Context, headDocumentOptions *HeadDocumentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headDocument(HeadDocumentOptions headDocumentOptions)
headDocument(params)
head_document(
        self,
        db: str,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        latest: Optional[bool] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the HeadDocumentOptions struct and set the fields to provide parameter values for the HeadDocument method.

Use the HeadDocumentOptions.Builder to create a HeadDocumentOptions object that contains the parameter values for the headDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify a document revision.

WithContext method only

The HeadDocument options.

The headDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/orders/0007741142412418284"
    
  • headDocumentOptions := service.NewHeadDocumentOptions(
      "events",
      "0007241142412418284",
    )
    
    response, err := service.HeadDocument(headDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    fmt.Println(response.StatusCode)
    fmt.Println(response.Headers["Etag"])
    
  • import com.ibm.cloud.sdk.core.http.Headers;
    
    import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.HeadDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    HeadDocumentOptions documentOptions =
        new HeadDocumentOptions.Builder()
            .db("events")
            .docId("0007741142412418284")
            .build();
    
    int statusCode =
        service.headDocument(documentOptions).execute()
            .getStatusCode();
    Headers headers =
        service.headDocument(documentOptions).execute()
            .getHeaders();
    
    System.out.println(statusCode);
    System.out.println(headers.values("ETag"));
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.headDocument({
      db: 'events',
      docId: '0007241142412418284'
    }).then(response => {
      console.log(response.status);
      console.log(response.headers['etag']);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.head_document(
      db='events',
      doc_id='0007241142412418284'
    )
    print(response.get_status_code())
    print(response.get_headers()['ETag'])
    

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for Document.

  • Document wasn't modified since specified revision.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create or modify a document

Creates or modifies a document in the specified database.

For creation, you must specify the document ID but you should not specify the revision.

For modification, you must specify the document ID and a revision identifier.

Creates or modifies a document in the specified database.

For creation, you must specify the document ID but you should not specify the revision.

For modification, you must specify the document ID and a revision identifier.

Creates or modifies a document in the specified database.

For creation, you must specify the document ID but you should not specify the revision.

For modification, you must specify the document ID and a revision identifier.

Creates or modifies a document in the specified database.

For creation, you must specify the document ID but you should not specify the revision.

For modification, you must specify the document ID and a revision identifier.

Creates or modifies a document in the specified database.

For creation, you must specify the document ID but you should not specify the revision.

For modification, you must specify the document ID and a revision identifier.

PUT /{db}/{doc_id}
(cloudant *CloudantV1) PutDocument(putDocumentOptions *PutDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutDocumentWithContext(ctx context.Context, putDocumentOptions *PutDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> putDocument(PutDocumentOptions putDocumentOptions)
putDocument(params)
put_document(
        self,
        db: str,
        doc_id: str,
        document: Union['Document', BinaryIO],
        *,
        content_type: Optional[str] = None,
        if_match: Optional[str] = None,
        batch: Optional[str] = None,
        new_edits: Optional[bool] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.data-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.data-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PutDocumentOptions struct and set the fields to provide parameter values for the PutDocument method.

Use the PutDocumentOptions.Builder to create a PutDocumentOptions object that contains the parameter values for the putDocument method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Allowable values: [application/json,multipart/mixed,multipart/related]

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

HTTP request body for Document operations.

Examples:
Document

WithContext method only

The PutDocument options.

The putDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • HTTP request body for Document operations.

  • The type of the input.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

    Default: application/json

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Schema for a document.

  • The type of the input.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

    Default: application/json

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/events/0007241142412418284" -H "Content-Type: application/json" --data '{
      "type": "event",
      "userid": "abc123",
      "eventType": "addedToBasket",
      "productId": "1000042",
      "date": "2019-01-28T10:44:22.000Z"
    }'
    
  • eventDoc := cloudantv1.Document{}
    eventDoc.SetProperty("type", "event")
    eventDoc.SetProperty("userid", "abc123")
    eventDoc.SetProperty("eventType", "addedToBasket")
    eventDoc.SetProperty("productId", "1000042")
    eventDoc.SetProperty("date", "2019-01-28T10:44:22.000Z")
    
    putDocumentOptions := service.NewPutDocumentOptions(
      "events",
      "0007241142412418284",
    )
    putDocumentOptions.SetDocument(&eventDoc)
    
    documentResult, response, err := service.PutDocument(putDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PutDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    Document eventDoc = new Document();
    eventDoc.put("type", "event");
    eventDoc.put("userid", "abc123");
    eventDoc.put("eventType", "addedToBasket");
    eventDoc.put("productId", "1000042");
    eventDoc.put("date", "2019-01-28T10:44:22.000Z");
    
    PutDocumentOptions documentOptions =
        new PutDocumentOptions.Builder()
            .db("events")
            .docId("0007241142412418284")
            .document(eventDoc)
            .build();
    
    DocumentResult response =
        service.putDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const eventDoc: CloudantV1.Document = {
      type: 'event',
      userid: 'abc123',
      eventType: 'addedToBasket',
      productId: '1000042',
      date: '2019-01-28T10:44:22.000Z'
    };
    
    service.putDocument({
      db: 'events',
      docId: '0007241142412418284',
      document: eventDoc
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import Document, CloudantV1
    
    service = CloudantV1.new_instance()
    
    event_doc = Document(
      type='event',
      userid='abc123',
      eventType='addedToBasket',
      productId='1000042',
      date='2019-01-28T10:44:22.000Z'
    )
    response = service.put_document(
      db='events',
      doc_id='0007241142412418284',
      document=event_doc
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete a design document

Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

DELETE /{db}/_design/{ddoc}
(cloudant *CloudantV1) DeleteDesignDocument(deleteDesignDocumentOptions *DeleteDesignDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteDesignDocumentWithContext(ctx context.Context, deleteDesignDocumentOptions *DeleteDesignDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> deleteDesignDocument(DeleteDesignDocumentOptions deleteDesignDocumentOptions)
deleteDesignDocument(params)
delete_design_document(
        self,
        db: str,
        ddoc: str,
        *,
        if_match: Optional[str] = None,
        batch: Optional[str] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.design-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.design-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the DeleteDesignDocumentOptions struct and set the fields to provide parameter values for the DeleteDesignDocument method.

Use the DeleteDesignDocumentOptions.Builder to create a DeleteDesignDocumentOptions object that contains the parameter values for the deleteDesignDocument method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

WithContext method only

The DeleteDesignDocument options.

The deleteDesignDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/products/_design/appliances?rev=1-98e6a25b3b45df62e7d47095ac15b16a"
    
  • deleteDesignDocumentOptions := service.NewDeleteDesignDocumentOptions(
      "products",
      "appliances",
    )
    deleteDesignDocumentOptions.SetRev("1-98e6a25b3b45df62e7d47095ac15b16a")
    
    documentResult, response, err := service.DeleteDesignDocument(deleteDesignDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    

    This request requires the example revisions in the DELETE body to be replaced with valid revisions.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteDesignDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteDesignDocumentOptions designDocumentOptions =
        new DeleteDesignDocumentOptions.Builder()
            .db("products")
            .ddoc("appliances")
            .rev("1-98e6a25b3b45df62e7d47095ac15b16a")
            .build();
    
    DocumentResult response =
        service.deleteDesignDocument(designDocumentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.deleteDesignDocument({
      db: 'products',
      ddoc: 'appliances',
      rev: '1-98e6a25b3b45df62e7d47095ac15b16a'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_design_document(
      db='products',
      ddoc='appliances',
      rev='1-98e6a25b3b45df62e7d47095ac15b16a'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve a design document

Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.

Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.

Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.

Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.

Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.

GET /{db}/_design/{ddoc}
(cloudant *CloudantV1) GetDesignDocument(getDesignDocumentOptions *GetDesignDocumentOptions) (result *DesignDocument, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDesignDocumentWithContext(ctx context.Context, getDesignDocumentOptions *GetDesignDocumentOptions) (result *DesignDocument, response *core.DetailedResponse, err error)
ServiceCall<DesignDocument> getDesignDocument(GetDesignDocumentOptions getDesignDocumentOptions)
getDesignDocument(params)
get_design_document(
        self,
        db: str,
        ddoc: str,
        *,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        deleted_conflicts: Optional[bool] = None,
        latest: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        meta: Optional[bool] = None,
        rev: Optional[str] = None,
        revs: Optional[bool] = None,
        revs_info: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetDesignDocumentOptions struct and set the fields to provide parameter values for the GetDesignDocument method.

Use the GetDesignDocumentOptions.Builder to create a GetDesignDocumentOptions object that contains the parameter values for the getDesignDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments only since specified revisions. Note this does not include the attachments for the specified revisions.

    Examples:
    View
  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify leaf revisions to retrieve. Additionally, it accepts a value of all to return all leaf revisions.

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

WithContext method only

The GetDesignDocument options.

The getDesignDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_design/appliances?latest=true"
    
  • getDesignDocumentOptions := service.NewGetDesignDocumentOptions(
      "products",
      "appliances",
    )
    getDesignDocumentOptions.SetLatest(true)
    
    designDocument, response, err := service.GetDesignDocument(getDesignDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(designDocument, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DesignDocument;
    import com.ibm.cloud.cloudant.v1.model.GetDesignDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    GetDesignDocumentOptions designDocumentOptions = new GetDesignDocumentOptions.Builder()
        .db("products")
        .ddoc("appliances")
        .latest(true)
        .build();
    
    DesignDocument response =
        service.getDesignDocument(designDocumentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getDesignDocument({
      db: 'products',
      ddoc: 'appliances',
      latest: true
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_design_document(
      db='products',
      ddoc='appliances',
      latest=True
    ).get_result()
    
    print(response)
    

Response

Schema for a design document.

Schema for a design document.

Schema for a design document.

Schema for a design document.

Schema for a design document.

Status Code

  • HTTP response for DesignDocument.

  • Document wasn't modified since specified revision.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DesignDocument.

    {
      "_id": "_design/appliances",
      "_rev": "8-7e2537e5989294471061e0cfd7292725",
      "indexes": {
        "findByPrice": {
          "analyzer": {
            "name": "standard"
          },
          "index": "function (doc) {\n  index(\"price\", doc.price);\n}"
        }
      },
      "views": {
        "byApplianceProdId": {
          "map": "function(doc) { \n  emit(doc.productid, [doc.brand, doc.name, doc.description]) \n}"
        }
      }
    }
  • Example DesignDocument.

    {
      "_id": "_design/appliances",
      "_rev": "8-7e2537e5989294471061e0cfd7292725",
      "indexes": {
        "findByPrice": {
          "analyzer": {
            "name": "standard"
          },
          "index": "function (doc) {\n  index(\"price\", doc.price);\n}"
        }
      },
      "views": {
        "byApplianceProdId": {
          "map": "function(doc) { \n  emit(doc.productid, [doc.brand, doc.name, doc.description]) \n}"
        }
      }
    }
  • Example DesignDocument for a database partition.

    {
      "_id": "_design/partitioned_appliances",
      "_rev": "8-7e2537e5989294471061e0cfd7292725",
      "indexes": {
        "findByBrand": {
          "analyzer": {
            "name": "standard"
          },
          "index": "function (doc) {\n  index(\"brand\", doc.brand);\n}"
        }
      },
      "language": "javascript",
      "options": {
        "partitioned": true
      }
    }
  • Example DesignDocument for a database partition.

    {
      "_id": "_design/partitioned_appliances",
      "_rev": "8-7e2537e5989294471061e0cfd7292725",
      "indexes": {
        "findByBrand": {
          "analyzer": {
            "name": "standard"
          },
          "index": "function (doc) {\n  index(\"brand\", doc.brand);\n}"
        }
      },
      "language": "javascript",
      "options": {
        "partitioned": true
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for a design document

This method supports the same query arguments as the GET /{db}/_design/{ddoc} method, but the results include only the header information (including design document size, and the revision as an ETag). The ETag header shows the current revision for the requested design document, and if you requested the design document in full, the Content-Length specifies the length of the data. If you add any of the query arguments, then the resulting HTTP headers correspond to what is returned for the equivalent GET request.

This method supports the same query arguments as the GET /{db}/_design/{ddoc} method, but the results include only the header information (including design document size, and the revision as an ETag). The ETag header shows the current revision for the requested design document, and if you requested the design document in full, the Content-Length specifies the length of the data. If you add any of the query arguments, then the resulting HTTP headers correspond to what is returned for the equivalent GET request.

This method supports the same query arguments as the GET /{db}/_design/{ddoc} method, but the results include only the header information (including design document size, and the revision as an ETag). The ETag header shows the current revision for the requested design document, and if you requested the design document in full, the Content-Length specifies the length of the data. If you add any of the query arguments, then the resulting HTTP headers correspond to what is returned for the equivalent GET request.

This method supports the same query arguments as the GET /{db}/_design/{ddoc} method, but the results include only the header information (including design document size, and the revision as an ETag). The ETag header shows the current revision for the requested design document, and if you requested the design document in full, the Content-Length specifies the length of the data. If you add any of the query arguments, then the resulting HTTP headers correspond to what is returned for the equivalent GET request.

This method supports the same query arguments as the GET /{db}/_design/{ddoc} method, but the results include only the header information (including design document size, and the revision as an ETag). The ETag header shows the current revision for the requested design document, and if you requested the design document in full, the Content-Length specifies the length of the data. If you add any of the query arguments, then the resulting HTTP headers correspond to what is returned for the equivalent GET request.

HEAD /{db}/_design/{ddoc}
(cloudant *CloudantV1) HeadDesignDocument(headDesignDocumentOptions *HeadDesignDocumentOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadDesignDocumentWithContext(ctx context.Context, headDesignDocumentOptions *HeadDesignDocumentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headDesignDocument(HeadDesignDocumentOptions headDesignDocumentOptions)
headDesignDocument(params)
head_design_document(
        self,
        db: str,
        ddoc: str,
        *,
        if_none_match: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the HeadDesignDocumentOptions struct and set the fields to provide parameter values for the HeadDesignDocument method.

Use the HeadDesignDocumentOptions.Builder to create a HeadDesignDocumentOptions object that contains the parameter values for the headDesignDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The HeadDesignDocument options.

The headDesignDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/products/_design/appliances"
    
  • headDesignDocumentOptions := service.NewHeadDesignDocumentOptions(
      "products",
      "appliances",
    )
    
    response, err := service.HeadDesignDocument(headDesignDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    fmt.Println(response.StatusCode)
    fmt.Println(response.Headers["Etag"])
    
  • import com.ibm.cloud.sdk.core.http.Headers;
    
    import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.HeadDesignDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    HeadDesignDocumentOptions designDocumentOptions =
        new HeadDesignDocumentOptions.Builder()
            .db("products")
            .ddoc("appliances")
            .build();
    
    int statusCode =
        service.headDesignDocument(designDocumentOptions).execute()
            .getStatusCode();
    
    Headers headers =
        service.headDesignDocument(designDocumentOptions).execute()
            .getHeaders();
    
    System.out.println(statusCode);
    System.out.println(headers.values("ETag"));
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.headDesignDocument({
      db: 'products',
      ddoc: 'appliances'
    }).then(response => {
      console.log(response.status);
      console.log(response.headers['etag']);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.head_design_document(
      db='products',
      ddoc='appliances'
    )
    print(response.get_status_code())
    print(response.get_headers()['ETag'])
    

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for DesignDocument.

  • Document wasn't modified since specified revision.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create or modify a design document

The PUT method creates a new named design document, or creates a new revision of the existing design document.

The PUT method creates a new named design document, or creates a new revision of the existing design document.

The PUT method creates a new named design document, or creates a new revision of the existing design document.

The PUT method creates a new named design document, or creates a new revision of the existing design document.

The PUT method creates a new named design document, or creates a new revision of the existing design document.

PUT /{db}/_design/{ddoc}
(cloudant *CloudantV1) PutDesignDocument(putDesignDocumentOptions *PutDesignDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutDesignDocumentWithContext(ctx context.Context, putDesignDocumentOptions *PutDesignDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> putDesignDocument(PutDesignDocumentOptions putDesignDocumentOptions)
putDesignDocument(params)
put_design_document(
        self,
        db: str,
        ddoc: str,
        design_document: 'DesignDocument',
        *,
        if_match: Optional[str] = None,
        batch: Optional[str] = None,
        new_edits: Optional[bool] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.design-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.design-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PutDesignDocumentOptions struct and set the fields to provide parameter values for the PutDesignDocument method.

Use the PutDesignDocumentOptions.Builder to create a PutDesignDocumentOptions object that contains the parameter values for the putDesignDocument method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

HTTP request body for DesignDocument operations.

Examples:
DesignDocument

WithContext method only

The PutDesignDocument options.

The putDesignDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Schema for a design document.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Schema for a design document.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/users/_design/allusers" -H "Content-Type: application/json" --data '{
      "views": {
        "getVerifiedEmails": {
          "map": "function(doc) { if(doc.email_verified  === true){ emit(doc.email, [doc.name, doc.email_verified, doc.joined]) }}"
        }
      },
      "indexes": {
        "activeUsers": {
          "index": "function (doc) {  index(\"name\", doc.name);  index(\"active\", doc.active); }"
        }
      }
    }'
    
    curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/products/_design/appliances" -H "Content-Type: application/json" --data '{
      "views": {
        "byApplianceProdId": {
          "map": "function(doc) { emit(doc.productid, [doc.brand, doc.name, doc.description]) }"
        }
      },
      "indexes": {
        "findByPrice": {
          "index": "function (doc) {  index(\"price\", doc.price);  }"
        }
      }
    }'
    

    This example creates allusers design document in the users database and appliances design document in the partitioned products database.

  • emailViewMapReduce, err := service.NewDesignDocumentViewsMapReduce(
      "function(doc) {" +
        "if(doc.email_verified  === true){ emit(doc.email, [doc.name, doc.email_verified, doc.joined])" +
      "}",
    )
    if err != nil {
      panic(err)
    }
    
    userIndexDefinition, err := service.NewSearchIndexDefinition(
      "function(doc) {" +
        "index(\"name\", doc.name); index(\"active\", doc.active);" +
      "}",
    )
    if err != nil {
      panic(err)
    }
    
    designDocument := &cloudantv1.DesignDocument{
      Views: map[string]cloudantv1.DesignDocumentViewsMapReduce{
        "getVerifiedEmails": *emailViewMapReduce,
      },
      Indexes: map[string]cloudantv1.SearchIndexDefinition{
        "activeUsers": *userIndexDefinition,
      },
    }
    
    putDesignDocumentOptions := service.NewPutDesignDocumentOptions(
      "users",
      "allusers",
      designDocument,
    )
    
    documentResult, response, err := service.PutDesignDocument(putDesignDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
    applianceProdIdViewMapReduce, err := service.NewDesignDocumentViewsMapReduce(
      "function(doc) {" +
        "emit(doc.productid, [doc.brand, doc.name, doc.description])" +
      "}",
    )
    if err != nil {
      panic(err)
    }
    
    priceIndexDefinition, err := service.NewSearchIndexDefinition(
      "function(doc) {" +
        "index(\"price\", doc.price);" +
      "}",
    )
    if err != nil {
      panic(err)
    }
    
    partitionedDesignDocument := &cloudantv1.DesignDocument{
      Views: map[string]cloudantv1.DesignDocumentViewsMapReduce{
        "byApplianceProdId": *applianceProdIdViewMapReduce,
      },
      Indexes: map[string]cloudantv1.SearchIndexDefinition{
        "findByPrice": *priceIndexDefinition,
      },
    }
    
    putPartitionedDesignDocumentOptions := service.NewPutDesignDocumentOptions(
      "products",
      "appliances",
      partitionedDesignDocument,
    )
    
    documentResult, response, err = service.PutDesignDocument(putPartitionedDesignDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ = json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    

    This example creates allusers design document in the users database and appliances design document in the partitioned products database.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DesignDocument;
    import com.ibm.cloud.cloudant.v1.model.DesignDocumentViewsMapReduce;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PutDesignDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.SearchIndexDefinition;
    
    import java.util.Collections;
    
    Cloudant service = Cloudant.newInstance();
    
    DesignDocumentViewsMapReduce emailViewMapReduce =
        new DesignDocumentViewsMapReduce.Builder()
            .map("function(doc) { if(doc.email_verified  === true){\n  emit(doc.email, [doc.name, doc.email_verified, doc.joined]) }}")
            .build();
    
    SearchIndexDefinition usersIndex =
        new SearchIndexDefinition.Builder()
            .index("function (doc) {\n  index(\"name\", doc.name);\n  index(\"active\", doc.active);\n}")
            .build();
    
    DesignDocument designDocument = new DesignDocument();
    designDocument.setViews(
        Collections.singletonMap("getVerifiedEmails", emailViewMapReduce));
    designDocument.setIndexes(
        Collections.singletonMap("activeUsers", usersIndex));
    
    PutDesignDocumentOptions designDocumentOptions =
        new PutDesignDocumentOptions.Builder()
            .db("users")
            .designDocument(designDocument)
            .ddoc("allusers")
            .build();
    
    DocumentResult response =
        service.putDesignDocument(designDocumentOptions).execute()
            .getResult();
    
    DesignDocumentViewsMapReduce applianceView =
        new DesignDocumentViewsMapReduce.Builder()
            .map("function(doc) { emit(doc.productid, [doc.brand, doc.name, doc.description]) }")
            .build();
    
    SearchIndexDefinition priceIndex =
        new SearchIndexDefinition.Builder()
            .index("function (doc) {  index(\"price\", doc.price);}")
            .build();
    
    DesignDocument partitionedDesignDocument = new DesignDocument();
    partitionedDesignDocument.setViews(
        Collections.singletonMap("byApplianceProdId", applianceView));
    partitionedDesignDocument.setIndexes(
        Collections.singletonMap("findByPrice", priceIndex));
    
    PutDesignDocumentOptions partitionedDesignDocumentOptions =
        new PutDesignDocumentOptions.Builder()
            .db("products")
            .designDocument(partitionedDesignDocument)
            .ddoc("appliances")
            .build();
    
    DocumentResult response =
        service.putDesignDocument(partitionedDesignDocumentOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example creates allusers design document in the users database and appliances design document in the partitioned products database.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const emailViewMapReduce: CloudantV1.DesignDocumentViewsMapReduce = {
      map: 'function(doc) { if(doc.email_verified  === true){\n  emit(doc.email, [doc.name, doc.email_verified, doc.joined]) }}'
    }
    
    const userIndex: CloudantV1.SearchIndexDefinition = {
      index: 'function (doc) {  index("name", doc.name);  index("active", doc.active);}'
    }
    
    const designDocument: CloudantV1.DesignDocument = {
      views: {'getVerifiedEmails': emailViewMapReduce},
      indexes: {'activeUsers': userIndex}}
    
    service.putDesignDocument({
      db: 'users',
      designDocument: designDocument,
      ddoc: 'allusers'
    }).then(response => {
      console.log(response.result);
    });
    
    const productMap: CloudantV1.DesignDocumentViewsMapReduce = {
      map: 'function(doc) { emit(doc.productid, [doc.brand, doc.name, doc.description]) }'
    }
    
    const priceIndex: CloudantV1.SearchIndexDefinition = {
      index: 'function (doc) {  index(\"price\", doc.price);}'
    }
    
    const partitionedDesignDoc: CloudantV1.DesignDocument = {
      views: {'byApplianceProdId': productMap},
      indexes: {'findByPrice': priceIndex}}
    
    service.putDesignDocument({
      db: 'products',
      designDocument: partitionedDesignDoc,
      ddoc: 'appliances'
    }).then(response => {
      console.log(response.result);
    });
    

    This example creates allusers design document in the users database and appliances design document in the partitioned products database.

  • from ibmcloudant.cloudant_v1 import Analyzer, AnalyzerConfiguration, CloudantV1, DesignDocument, DesignDocumentOptions, DesignDocumentViewsMapReduce, SearchIndexDefinition
    
    service = CloudantV1.new_instance()
    
    email_view_map_reduce = DesignDocumentViewsMapReduce(
      map='function(doc) { if(doc.email_verified  === true){\n  emit(doc.email, [doc.name, doc.email_verified, doc.joined]) }}'
    )
    
    user_index = SearchIndexDefinition(
      index='function (doc) { index("name", doc.name); index("active", doc.active); }',
      analyzer=AnalyzerConfiguration(name="standard", fields={"email": Analyzer(name="email")}))
    
    design_document = DesignDocument(
      views={'getVerifiedEmails': email_view_map_reduce},
      indexes={'activeUsers': user_index}
    )
    
    response = service.put_design_document(
      db='users',
      design_document=design_document,
      ddoc='allusers'
    ).get_result()
    
    print(response)
    
    # Partitioned DesignDocument Example
    
    product_map = DesignDocumentViewsMapReduce(
      map='function(doc) { emit(doc.productId, [doc.brand, doc.name, doc.description]) }'
    )
    
    price_index = SearchIndexDefinition(
      index='function (doc) { index("price", doc.price);}',
      analyzer=AnalyzerConfiguration(name="classic", fields={"description": Analyzer(name="english")})
    )
    
    design_document_options = DesignDocumentOptions(
      partitioned=True
    )
    
    partitioned_design_doc = DesignDocument(
      views={'byApplianceProdId': product_map},
      indexes={'findByPrice': price_index},
      options=design_document_options
    )
    
    response = service.put_design_document(
      db='products',
      design_document=partitioned_design_doc,
      ddoc='appliances'
    ).get_result()
    
    print(response)
    

    This example creates allusers design document in the users database and appliances design document in the partitioned products database.

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about a design document

Retrieves information about the specified design document, including the index, index size, and current status of the design document and associated index information.

Retrieves information about the specified design document, including the index, index size, and current status of the design document and associated index information.

Retrieves information about the specified design document, including the index, index size, and current status of the design document and associated index information.

Retrieves information about the specified design document, including the index, index size, and current status of the design document and associated index information.

Retrieves information about the specified design document, including the index, index size, and current status of the design document and associated index information.

GET /{db}/_design/{ddoc}/_info
(cloudant *CloudantV1) GetDesignDocumentInformation(getDesignDocumentInformationOptions *GetDesignDocumentInformationOptions) (result *DesignDocumentInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDesignDocumentInformationWithContext(ctx context.Context, getDesignDocumentInformationOptions *GetDesignDocumentInformationOptions) (result *DesignDocumentInformation, response *core.DetailedResponse, err error)
ServiceCall<DesignDocumentInformation> getDesignDocumentInformation(GetDesignDocumentInformationOptions getDesignDocumentInformationOptions)
getDesignDocumentInformation(params)
get_design_document_information(
        self,
        db: str,
        ddoc: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Instantiate the GetDesignDocumentInformationOptions struct and set the fields to provide parameter values for the GetDesignDocumentInformation method.

Use the GetDesignDocumentInformationOptions.Builder to create a GetDesignDocumentInformationOptions object that contains the parameter values for the getDesignDocumentInformation method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The GetDesignDocumentInformation options.

The getDesignDocumentInformation options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_design/appliances/_info"
    
  • getDesignDocumentInformationOptions := service.NewGetDesignDocumentInformationOptions(
      "products",
      "appliances",
    )
    
    designDocumentInformation, response, err := service.GetDesignDocumentInformation(getDesignDocumentInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(designDocumentInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DesignDocumentInformation;
    import com.ibm.cloud.cloudant.v1.model.GetDesignDocumentInformationOptions;
    
    
    
    Cloudant service = Cloudant.newInstance();
    
    GetDesignDocumentInformationOptions informationOptions =
        new GetDesignDocumentInformationOptions.Builder()
            .db("stores")
            .ddoc("appliances")
            .build();
    
    DesignDocumentInformation response =
        service.getDesignDocumentInformation(informationOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getDesignDocumentInformation({
      db: 'products',
      ddoc: 'appliances'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_design_document_information(
      db='products',
      ddoc='appliances'
    ).get_result()
    
    print(response)
    

Response

Schema for information about a design document.

Schema for information about a design document.

Schema for information about a design document.

Schema for information about a design document.

Schema for information about a design document.

Status Code

  • HTTP response for /{db}/_design/{ddoc}/_info style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DesignDocumentInformation response.

    {
      "name": "appliances",
      "view_index": {
        "collator_versions": [
          "153.72"
        ],
        "compact_running": false,
        "data_size": 926691,
        "disk_size": 1982704,
        "language": "javascript",
        "purge_seq": 0,
        "signature": "a85901c6c0c027ab8f319f9995b6d951",
        "sizes": {
          "active": 593,
          "external": 703,
          "file": 70340
        },
        "update_seq": 47,
        "updater_running": false,
        "updates_pending": {
          "minimum": 42,
          "preferred": 42,
          "total": 42
        },
        "waiting_clients": 0,
        "waiting_commit": false
      }
    }
  • Example DesignDocumentInformation response.

    {
      "name": "appliances",
      "view_index": {
        "collator_versions": [
          "153.72"
        ],
        "compact_running": false,
        "data_size": 926691,
        "disk_size": 1982704,
        "language": "javascript",
        "purge_seq": 0,
        "signature": "a85901c6c0c027ab8f319f9995b6d951",
        "sizes": {
          "active": 593,
          "external": 703,
          "file": 70340
        },
        "update_seq": 47,
        "updater_running": false,
        "updates_pending": {
          "minimum": 42,
          "preferred": 42,
          "total": 42
        },
        "waiting_clients": 0,
        "waiting_commit": false
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers about a design document

Retrieves the HTTP headers about the specified design document.

HEAD /{db}/_design/{ddoc}/_info

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_design/{ddoc}/_info style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a list of all design documents in a database (GET)

Queries the index of all design document IDs. The results matching the query parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

GET /{db}/_design_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/users/_design_docs?attachments=true"
    

Response

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a list of all design documents in a database (GET)

Retrieves the HTTP headers for a list of all design documents in a database (GET).

HEAD /{db}/_design_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a list of all design documents in a database

Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

POST /{db}/_design_docs
(cloudant *CloudantV1) PostDesignDocs(postDesignDocsOptions *PostDesignDocsOptions) (result *AllDocsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostDesignDocsWithContext(ctx context.Context, postDesignDocsOptions *PostDesignDocsOptions) (result *AllDocsResult, response *core.DetailedResponse, err error)
ServiceCall<AllDocsResult> postDesignDocs(PostDesignDocsOptions postDesignDocsOptions)
postDesignDocs(params)
post_design_docs(
        self,
        db: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[str] = None,
        key: Optional[str] = None,
        keys: Optional[List[str]] = None,
        start_key: Optional[str] = None,
        accept: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostDesignDocsOptions struct and set the fields to provide parameter values for the PostDesignDocs method.

Use the PostDesignDocsOptions.Builder to create a PostDesignDocsOptions object that contains the parameter values for the postDesignDocs method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postAllDocs and postPartitionAllDocs.

Examples:
AllDocsQuery

WithContext method only

The PostDesignDocs options.

The postDesignDocs options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • The type of the response: application/json or application/octet-stream.

    Allowable values: [application/json,application/octet-stream]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • The type of the response: application/json or application/octet-stream.

    Allowable values: [application/json,application/octet-stream]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_design_docs" -H "Content-Type: application/json" --data '{
      "attachments": true
    }'
    
  • postDesignDocsOptions := service.NewPostDesignDocsOptions(
      "users",
    )
    postDesignDocsOptions.SetAttachments(true)
    
    allDocsResult, response, err := service.PostDesignDocs(postDesignDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(allDocsResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.AllDocsResult;
    import com.ibm.cloud.cloudant.v1.model.PostDesignDocsOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PostDesignDocsOptions docsOptions =
        new PostDesignDocsOptions.Builder()
            .attachments(true)
            .db("users")
            .build();
    
    AllDocsResult response =
        service.postDesignDocs(docsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postDesignDocs({
      attachments: true,
      db: 'users'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_design_docs(
      attachments=True,
      db='users'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Multi-query the list of all design documents

This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.

This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.

This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.

This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.

This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.

POST /{db}/_design_docs/queries
(cloudant *CloudantV1) PostDesignDocsQueries(postDesignDocsQueriesOptions *PostDesignDocsQueriesOptions) (result *AllDocsQueriesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostDesignDocsQueriesWithContext(ctx context.Context, postDesignDocsQueriesOptions *PostDesignDocsQueriesOptions) (result *AllDocsQueriesResult, response *core.DetailedResponse, err error)
ServiceCall<AllDocsQueriesResult> postDesignDocsQueries(PostDesignDocsQueriesOptions postDesignDocsQueriesOptions)
postDesignDocsQueries(params)
post_design_docs_queries(
        self,
        db: str,
        queries: List['AllDocsQuery'],
        *,
        accept: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query per query in the request.

Request

Instantiate the PostDesignDocsQueriesOptions struct and set the fields to provide parameter values for the PostDesignDocsQueries method.

Use the PostDesignDocsQueriesOptions.Builder to create a PostDesignDocsQueriesOptions object that contains the parameter values for the postDesignDocsQueries method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for allDocsQueriesQuery, designDocsQueriesQuery and localDocsQueriesQuery.

Examples:
AllDocsQueriesQuery

WithContext method only

The PostDesignDocsQueries options.

The postDesignDocsQueries options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.

  • The type of the response: application/json or application/octet-stream.

    Allowable values: [application/json,application/octet-stream]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.

  • The type of the response: application/json or application/octet-stream.

    Allowable values: [application/json,application/octet-stream]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_design_docs/queries" -H "Content-Type: application/json" --data '{
      "queries": [
        {
          "descending": true,
          "include_docs": true,
          "limit": 10
        },
        {
          "inclusive_end": true,
          "key": "_design/allusers",
          "skip": 1
        }
      ]
    }'
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    doc1 := cloudantv1.AllDocsQuery{
      Descending:  core.BoolPtr(true),
      IncludeDocs: core.BoolPtr(true),
      Limit:       core.Int64Ptr(10),
    }
    
    doc2 := cloudantv1.AllDocsQuery{
      InclusiveEnd: core.BoolPtr(true),
      Key:          core.StringPtr("_design/allusers"),
      Skip:         core.Int64Ptr(1),
    }
    
    postDesignDocsQueriesOptions := service.NewPostDesignDocsQueriesOptions(
      "users",
      []cloudantv1.AllDocsQuery{
        doc1,
        doc2,
      },
    )
    
    allDocsQueriesResult, response, err := service.PostDesignDocsQueries(postDesignDocsQueriesOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(allDocsQueriesResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.AllDocsQueriesResult;
    import com.ibm.cloud.cloudant.v1.model.AllDocsQuery;
    import com.ibm.cloud.cloudant.v1.model.PostDesignDocsQueriesOptions;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    AllDocsQuery query1 = new AllDocsQuery.Builder()
        .descending(true)
        .includeDocs(true)
        .limit(10)
        .build();
    AllDocsQuery query2 = new AllDocsQuery.Builder()
        .inclusiveEnd(true)
        .key("_design/allusers")
        .skip(1)
        .build();
    
    PostDesignDocsQueriesOptions queriesOptions =
        new PostDesignDocsQueriesOptions.Builder()
            .db("users")
            .queries(Arrays.asList(query1, query2))
            .build();
    
    AllDocsQueriesResult response =
        service.postDesignDocsQueries(queriesOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const doc1: CloudantV1.AllDocsQuery = {
      descending: true,
      includeDocs: true,
      limit: 10
    };
    const doc2: CloudantV1.AllDocsQuery = {
      inclusiveEnd: true,
      key: '_design/allusers',
      skip: 1
    };
    
    const allDocsQueries: CloudantV1.AllDocsQuery[] = [doc1, doc2];
    
    service.postDesignDocsQueries({
      db: 'users',
      queries: allDocsQueries
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import AllDocsQuery, CloudantV1
    
    service = CloudantV1.new_instance()
    
    doc1 = AllDocsQuery(
      descending=True,
      include_docs=True,
      limit=10
    )
    doc2 = AllDocsQuery(
      inclusive_end=True,
      key='_design/allusers',
      skip=1
    )
    
    response = service.post_design_docs_queries(
      db='users',
      queries=[doc1, doc2]
    ).get_result()
    
    print(response)
    

Response

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Schema for the result of an all documents queries operation.

Status Code

  • HTTP response for /_all_docs/queries style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsQueriesResult response.

    {
      "results": [
        {
          "offset": null,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        },
        {
          "offset": 2,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        }
      ]
    }
  • Example AllDocsQueriesResult response.

    {
      "results": [
        {
          "offset": null,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        },
        {
          "offset": 2,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a MapReduce view (GET)

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response.

GET /{db}/_design/{ddoc}/_view/{view}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to group reduced results by key. Valid only if a reduce function is defined in the view. If the view emits keys in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Query parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify whether to sort the returned rows. Setting this to false offers a performance boost. The total_rows and offset fields are not available when this is set to false.

    Default: true

  • Query parameter to specify whether use the same replica of the index on each request. The default value false contacts all replicas and returns the result from the first, fastest, responder. Setting it to true when used in conjunction with update=false may improve consistency at the expense of increased latency and decreased throughput, if the selected replica is not the fastest of the available replicas.

    Note: In general setting true is discouraged and is strictly not recommended when using update=true.

    Default: false

  • Note: stale is deprecated, use stable and update instead.

    Query parameter to specify whether to allow the results from a stale view to be used, without triggering a rebuild of all views within the encompassing design doc.

    • ok is equivalent to stable=true&update=false
    • update_after is equivalent to stable=true&update=lazy

    For more details on the use cases of stale, update, and stable parameters, see this blog post.

    Allowable values: [ok,update_after]

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

  • Query parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/users/_design/allusers/_view/getVerifiedEmails?limit=10"
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

Response

Schema for the result of a query view operation.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a MapReduce view (GET) query

Retrieves the HTTP headers for a MapReduce view (GET) query.

HEAD /{db}/_design/{ddoc}/_view/{view}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a MapReduce view

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

POST /{db}/_design/{ddoc}/_view/{view}
(cloudant *CloudantV1) PostView(postViewOptions *PostViewOptions) (result *ViewResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostViewWithContext(ctx context.Context, postViewOptions *PostViewOptions) (result *ViewResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostViewAsStream(postViewOptions *PostViewOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<ViewResult> postView(PostViewOptions postViewOptions)
ServiceCall<InputStream> postViewAsStream(PostViewOptions postViewOptions)
postView(params)
postViewAsStream(params)
post_view(
        self,
        db: str,
        ddoc: str,
        view: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[object] = None,
        end_key_doc_id: Optional[str] = None,
        group: Optional[bool] = None,
        group_level: Optional[int] = None,
        key: Optional[object] = None,
        keys: Optional[List[object]] = None,
        reduce: Optional[bool] = None,
        stable: Optional[bool] = None,
        start_key: Optional[object] = None,
        start_key_doc_id: Optional[str] = None,
        update: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_view_as_stream(
        self,
        db: str,
        ddoc: str,
        view: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[object] = None,
        end_key_doc_id: Optional[str] = None,
        group: Optional[bool] = None,
        group_level: Optional[int] = None,
        key: Optional[object] = None,
        keys: Optional[List[object]] = None,
        reduce: Optional[bool] = None,
        stable: Optional[bool] = None,
        start_key: Optional[object] = None,
        start_key_doc_id: Optional[str] = None,
        update: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostViewOptions struct and set the fields to provide parameter values for the PostView method.

Use the PostViewOptions.Builder to create a PostViewOptions object that contains the parameter values for the postView method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postView and postPartitionView.

Examples:
ViewQuery

WithContext method only

The PostView options.

The postView options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression /^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Schema for any JSON type.

  • Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.

  • Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Query parameter to specify whether use the same replica of the index on each request. The default value false contacts all replicas and returns the result from the first, fastest, responder. Setting it to true when used in conjunction with update=false may improve consistency at the expense of increased latency and decreased throughput if the selected replica is not the fastest of the available replicas.

    Note: In general setting true is discouraged and is strictly not recommended when using update=true.

    Default: false

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression /^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Schema for any JSON type.

  • Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.

  • Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Query parameter to specify whether use the same replica of the index on each request. The default value false contacts all replicas and returns the result from the first, fastest, responder. Setting it to true when used in conjunction with update=false may improve consistency at the expense of increased latency and decreased throughput if the selected replica is not the fastest of the available replicas.

    Note: In general setting true is discouraged and is strictly not recommended when using update=true.

    Default: false

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_design/allusers/_view/getVerifiedEmails" -H "Content-Type: application/json" --data '{
      "limit": 10
    }'
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • postViewOptions := service.NewPostViewOptions(
      "users",
      "allusers",
      "getVerifiedEmails",
    )
    
    viewResult, response, err := service.PostView(postViewOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(viewResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostViewOptions;
    import com.ibm.cloud.cloudant.v1.model.ViewResult;
    
    Cloudant service = Cloudant.newInstance();
    
    PostViewOptions viewOptions = new PostViewOptions.Builder()
        .db("users")
        .ddoc("allusers")
        .view("getVerifiedEmails")
        .build();
    
    ViewResult response =
        service.postView(viewOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postView({
      db: 'users',
      ddoc: 'allusers',
      view: 'getVerifiedEmails'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_view(
      db='users',
      ddoc='allusers',
      view='getVerifiedEmails'
    ).get_result()
    
    print(response)
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

Response

Response type for PostView: ViewResult

Response type for PostViewAsStream: io.ReadCloser

Response type for postView: ViewResult

Response type for postViewAsStream: InputStream

Response type for postView: ViewResult

Response type for postViewAsStream: NodeJS.ReadableStream

Response type for post_view: ViewResult

Response type for post_view_as_stream: BinaryIO

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Multi-query a MapReduce view

This operation runs multiple specified view queries against the view function from the specified design document.

This operation runs multiple specified view queries against the view function from the specified design document.

This operation runs multiple specified view queries against the view function from the specified design document.

This operation runs multiple specified view queries against the view function from the specified design document.

This operation runs multiple specified view queries against the view function from the specified design document.

POST /{db}/_design/{ddoc}/_view/{view}/queries
(cloudant *CloudantV1) PostViewQueries(postViewQueriesOptions *PostViewQueriesOptions) (result *ViewQueriesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostViewQueriesWithContext(ctx context.Context, postViewQueriesOptions *PostViewQueriesOptions) (result *ViewQueriesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostViewQueriesAsStream(postViewQueriesOptions *PostViewQueriesOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<ViewQueriesResult> postViewQueries(PostViewQueriesOptions postViewQueriesOptions)
ServiceCall<InputStream> postViewQueriesAsStream(PostViewQueriesOptions postViewQueriesOptions)
postViewQueries(params)
postViewQueriesAsStream(params)
post_view_queries(
        self,
        db: str,
        ddoc: str,
        view: str,
        queries: List['ViewQuery'],
        **kwargs,
    ) -> DetailedResponse
post_view_queries_as_stream(
        self,
        db: str,
        ddoc: str,
        view: str,
        queries: List['ViewQuery'],
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query per query in the request.

Request

Instantiate the PostViewQueriesOptions struct and set the fields to provide parameter values for the PostViewQueries method.

Use the PostViewQueriesOptions.Builder to create a PostViewQueriesOptions object that contains the parameter values for the postViewQueries method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postViewQueries.

Examples:
ViewQueriesQuery

WithContext method only

The PostViewQueries options.

The postViewQueries options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression /^[a-z][a-z0-9_$()+\/-]*$/

  • An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular view request.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression /^[a-z][a-z0-9_$()+\/-]*$/

  • An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular view request.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_design/allusers/_view/getVerifiedEmails/queries" -H "Content-Type: application/json" --data '{
      "queries": [
        {
          "include_docs": true,
          "limit": 5
        },
        {
          "descending": true,
          "skip": 1
        }
      ]
    }'
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    postViewQueriesOptions := service.NewPostViewQueriesOptions(
      "users",
      "allusers",
      "getVerifiedEmails",
      []cloudantv1.ViewQuery{
        {
          IncludeDocs: core.BoolPtr(true),
          Limit:       core.Int64Ptr(5),
        },
        {
          Descending: core.BoolPtr(true),
          Skip:       core.Int64Ptr(1),
        },
      },
    )
    
    viewQueriesResult, response, err := service.PostViewQueries(postViewQueriesOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(viewQueriesResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostViewQueriesOptions;
    import com.ibm.cloud.cloudant.v1.model.ViewQueriesResult;
    import com.ibm.cloud.cloudant.v1.model.ViewQuery;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    ViewQuery query1 = new ViewQuery.Builder()
        .includeDocs(true)
        .limit(5)
        .build();
    
    ViewQuery query2 = new ViewQuery.Builder()
        .descending(true)
        .skip(1)
        .build();
    
    PostViewQueriesOptions queriesOptions =
        new PostViewQueriesOptions.Builder()
            .db("users")
            .ddoc("allusers")
            .queries(Arrays.asList(query1, query2))
            .view("getVerifiedEmails")
            .build();
    
    ViewQueriesResult response =
        service.postViewQueries(queriesOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const viewQueries: CloudantV1.ViewQuery[] = [
      {
        includeDocs: true,
        limit: 5
      },
      {
        descending: true,
        skip: 1
      }
    ];
    service.postViewQueries({
      db: 'users',
      ddoc: 'allusers',
      queries: viewQueries,
      view: 'getVerifiedEmails'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

  • from ibmcloudant.cloudant_v1 import CloudantV1, ViewQuery
    
    service = CloudantV1.new_instance()
    
    query1 = ViewQuery(
      include_docs=True,
      limit=5
    )
    query2 = ViewQuery(
      descending=True,
      skip=1
    )
    
    response = service.post_view_queries(
      db='users',
      ddoc='allusers',
      queries=[query1, query2],
      view='getVerifiedEmails'
    ).get_result()
    
    print(response)
    

    This example requires the getVerifiedEmails view to exist. To create the design document with this view, see Create or modify a design document.

Response

Response type for PostViewQueries: ViewQueriesResult

Response type for PostViewQueriesAsStream: io.ReadCloser

Response type for postViewQueries: ViewQueriesResult

Response type for postViewQueriesAsStream: InputStream

Response type for postViewQueries: ViewQueriesResult

Response type for postViewQueriesAsStream: NodeJS.ReadableStream

Response type for post_view_queries: ViewQueriesResult

Response type for post_view_queries_as_stream: BinaryIO

Schema for the results of a queries view operation.

Schema for the results of a queries view operation.

Schema for the results of a queries view operation.

Schema for the results of a queries view operation.

Schema for the results of a queries view operation.

Status Code

  • HTTP response for postViewQueries.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ViewQueriesResult response.

    {
      "results": [
        {
          "offset": 0,
          "rows": [
            {
              "id": "abc125",
              "key": "amelie.smith@aol.com",
              "value": [
                "Amelie Smith",
                true,
                "2020-04-24T10:42:59.000Z"
              ]
            },
            {
              "id": "abc123",
              "key": "bob.smith@aol.com",
              "value": [
                "Bob Smith",
                true,
                "2019-01-24T10:42:59.000Z"
              ]
            }
          ],
          "total_rows": 2
        },
        {
          "offset": 1,
          "rows": [
            {
              "id": "abc125",
              "key": "amelie.smith@aol.com",
              "value": [
                "Amelie Smith",
                true,
                "2020-04-24T10:42:59.000Z"
              ]
            }
          ],
          "total_rows": 2
        }
      ]
    }
  • Example ViewQueriesResult response.

    {
      "results": [
        {
          "offset": 0,
          "rows": [
            {
              "id": "abc125",
              "key": "amelie.smith@aol.com",
              "value": [
                "Amelie Smith",
                true,
                "2020-04-24T10:42:59.000Z"
              ]
            },
            {
              "id": "abc123",
              "key": "bob.smith@aol.com",
              "value": [
                "Bob Smith",
                true,
                "2019-01-24T10:42:59.000Z"
              ]
            }
          ],
          "total_rows": 2
        },
        {
          "offset": 1,
          "rows": [
            {
              "id": "abc125",
              "key": "amelie.smith@aol.com",
              "value": [
                "Amelie Smith",
                true,
                "2020-04-24T10:42:59.000Z"
              ]
            }
          ],
          "total_rows": 2
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a database partition MapReduce view function (GET)

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response.

GET /{db}/_partition/{partition_key}/_design/{ddoc}/_view/{view}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to group reduced results by key. Valid only if a reduce function is defined in the view. If the view emits keys in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Query parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify whether to sort the returned rows. Setting this to false offers a performance boost. The total_rows and offset fields are not available when this is set to false.

    Default: true

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances/_design/appliances/_view/byApplianceProdId?include_docs=true&limit=10"
    

    This example requires the byApplianceProdId partitioned view to exist. To create the view, see Create or modify a design document.

Response

Schema for the result of a query view operation.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a database partition MapReduce view function (GET)

Retrieves the HTTP headers for a database partition MapReduce view function (GET).

HEAD /{db}/_partition/{partition_key}/_design/{ddoc}/_view/{view}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve information about which index is used for a query

Shows which index is being used by the query. Parameters are the same as the _find endpoint.

Shows which index is being used by the query. Parameters are the same as the _find endpoint.

Shows which index is being used by the query. Parameters are the same as the _find endpoint.

Shows which index is being used by the query. Parameters are the same as the _find endpoint.

Shows which index is being used by the query. Parameters are the same as the _find endpoint.

POST /{db}/_explain
(cloudant *CloudantV1) PostExplain(postExplainOptions *PostExplainOptions) (result *ExplainResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostExplainWithContext(ctx context.Context, postExplainOptions *PostExplainOptions) (result *ExplainResult, response *core.DetailedResponse, err error)
ServiceCall<ExplainResult> postExplain(PostExplainOptions postExplainOptions)
postExplain(params)
post_explain(
        self,
        db: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        r: Optional[int] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostExplainOptions struct and set the fields to provide parameter values for the PostExplain method.

Use the PostExplainOptions.Builder to create a PostExplainOptions object that contains the parameter values for the postExplain method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postFind and postExplain.

Examples:
FindQuery

WithContext method only

The PostExplain options.

The postExplain options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

  • The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.

    Possible values: 1 ≤ value ≤ 256

    Default: 1

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

  • The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.

    Possible values: 1 ≤ value ≤ 256

    Default: 1

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_explain" -H "Content-Type: application/json" --data '{
      "execution_stats": true,
      "limit": 10,
      "selector": {"type": {"$eq": "user"}}
    }'
    
  • postExplainOptions := service.NewPostExplainOptions(
      "users",
      map[string]interface{}{
        "type": map[string]string{
          "$eq": "user",
        },
      },
    )
    postExplainOptions.SetExecutionStats(true)
    postExplainOptions.SetLimit(10)
    
    explainResult, response, err := service.PostExplain(postExplainOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(explainResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ExplainResult;
    import com.ibm.cloud.cloudant.v1.model.PostExplainOptions;
    
    import java.util.Collections;
    import java.util.Map;
    
    Cloudant service = Cloudant.newInstance();
    
    Map<String, Object> selector = Collections.singletonMap(
        "type",
        Collections.singletonMap("$eq", "user"));
    
    PostExplainOptions explainOptions =
        new PostExplainOptions.Builder()
            .db("users")
            .executionStats(true)
            .limit(10)
            .selector(selector)
            .build();
    
    ExplainResult response =
        service.postExplain(explainOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const selector = {
      type: {
        "$eq": "user"
      }
    };
    
    service.postExplain({
      db: 'users',
      executionStats: true,
      limit: 10,
      selector: selector
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_explain(
      db='users',
      execution_stats=True,
      limit=10,
      selector={'type': {"$eq": "user"}}
    ).get_result()
    
    print(response)
    

Response

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Status Code

  • HTTP response for postExplain.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ExplainResult response.

    {
      "covering": false,
      "dbname": "users",
      "fields": [],
      "index": {
        "ddoc": "_design/id-index",
        "def": {
          "fields": [
            {
              "_id": "asc"
            }
          ]
        },
        "name": "d479bdddf50865e520a0193704c8b93a3bd48f77",
        "type": "json"
      },
      "limit": 10,
      "mrargs": {
        "conflicts": "undefined",
        "direction": "fwd",
        "end_key": [
          "<MAX>"
        ],
        "include_docs": true,
        "partition": null,
        "reduce": false,
        "stable": false,
        "start_key": [],
        "update": true,
        "view_type": "map"
      },
      "opts": {
        "bookmark": "nil",
        "conflicts": false,
        "execution_stats": true,
        "fields": [],
        "limit": 10,
        "partition": "",
        "r": 1,
        "skip": 0,
        "sort": {},
        "stable": false,
        "stale": false,
        "update": false,
        "use_index": []
      },
      "partitioned": true,
      "selector": {
        "type": {
          "$eq": "user"
        }
      },
      "skip": 0
    }
  • Example ExplainResult response.

    {
      "covering": false,
      "dbname": "users",
      "fields": [],
      "index": {
        "ddoc": "_design/id-index",
        "def": {
          "fields": [
            {
              "_id": "asc"
            }
          ]
        },
        "name": "d479bdddf50865e520a0193704c8b93a3bd48f77",
        "type": "json"
      },
      "limit": 10,
      "mrargs": {
        "conflicts": "undefined",
        "direction": "fwd",
        "end_key": [
          "<MAX>"
        ],
        "include_docs": true,
        "partition": null,
        "reduce": false,
        "stable": false,
        "start_key": [],
        "update": true,
        "view_type": "map"
      },
      "opts": {
        "bookmark": "nil",
        "conflicts": false,
        "execution_stats": true,
        "fields": [],
        "limit": 10,
        "partition": "",
        "r": 1,
        "skip": 0,
        "sort": {},
        "stable": false,
        "stale": false,
        "update": false,
        "use_index": []
      },
      "partitioned": true,
      "selector": {
        "type": {
          "$eq": "user"
        }
      },
      "skip": 0
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query an index by using selector syntax

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

POST /{db}/_find
(cloudant *CloudantV1) PostFind(postFindOptions *PostFindOptions) (result *FindResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostFindWithContext(ctx context.Context, postFindOptions *PostFindOptions) (result *FindResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostFindAsStream(postFindOptions *PostFindOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<FindResult> postFind(PostFindOptions postFindOptions)
ServiceCall<InputStream> postFindAsStream(PostFindOptions postFindOptions)
postFind(params)
postFindAsStream(params)
post_find(
        self,
        db: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        r: Optional[int] = None,
        **kwargs,
    ) -> DetailedResponse
post_find_as_stream(
        self,
        db: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        r: Optional[int] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostFindOptions struct and set the fields to provide parameter values for the PostFind method.

Use the PostFindOptions.Builder to create a PostFindOptions object that contains the parameter values for the postFind method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postFind and postExplain.

Examples:
FindQuery

WithContext method only

The PostFind options.

The postFind options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

  • The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.

    Possible values: 1 ≤ value ≤ 256

    Default: 1

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

  • The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.

    Possible values: 1 ≤ value ≤ 256

    Default: 1

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_find" -H "Content-Type: application/json" --data '{
      "fields": ["_id", "type", "name", "email"],
      "limit": 3,
      "selector": {
        "email_verified": {
          "$eq": true
        }
      },
      "sort": [{
        "email": "desc"
      }]
    }'
    

    This example requires the getUserByEmail Cloudant Query "json" index to exist. To create the index, see Create a new index on a database.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_find" -H "Content-Type: application/json" --data '{
      "fields": ["_id", "type", "name", "email", "address"],
      "limit": 3,
      "selector": {
        "address": {
          "$regex": "Street"
        }
      }
    }'
    

    This example requires the getUserByAddress Cloudant Query "text" index to exist. To create the index, see Create a new index on a database.

  • postFindOptions := service.NewPostFindOptions(
      "users",
      map[string]interface{}{
        "email_verified": map[string]bool{
          "$eq": true,
        },
      },
    )
    postFindOptions.SetFields(
      []string{"_id", "type", "name", "email"},
    )
    postFindOptions.SetSort([]map[string]string{{"email": "desc"}})
    postFindOptions.SetLimit(3)
    
    findResult, response, err := service.PostFind(postFindOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(findResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the getUserByEmail Cloudant Query "json" index to exist. To create the index, see Create a new index on a database.

  • postFindOptions := service.NewPostFindOptions(
      "users",
      map[string]interface{}{
        "address": map[string]string{
          "$regex": "Street",
        },
      },
    )
    postFindOptions.SetFields(
      []string{"_id", "type", "name", "email", "address"},
    )
    postFindOptions.SetLimit(3)
    
    findResult, response, err := service.PostFind(postFindOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(findResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the getUserByAddress Cloudant Query "text" index to exist. To create the index, see Create a new index on a database.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.FindResult;
    import com.ibm.cloud.cloudant.v1.model.PostFindOptions;
    
    import java.util.Arrays;
    import java.util.Collections;
    import java.util.Map;
    
    Cloudant service = Cloudant.newInstance();
    
    Map<String, Object> selector = Collections.singletonMap(
        "email_verified",
        Collections.singletonMap("$eq", true));
    
    Map<String, String> fieldSort = Collections.singletonMap("email", "desc");
    
    PostFindOptions findOptions = new PostFindOptions.Builder()
        .db("users")
        .selector(selector)
        .fields(Arrays.asList("_id", "type", "name", "email"))
        .addSort(fieldSort)
        .limit(3)
        .build();
    
    FindResult response =
        service.postFind(findOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the getUserByEmail Cloudant Query "json" index to exist. To create the index, see Create a new index on a database.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.FindResult;
    import com.ibm.cloud.cloudant.v1.model.PostFindOptions;
    
    import java.util.Arrays;
    import java.util.Collections;
    import java.util.Map;
    
    Cloudant service = Cloudant.newInstance();
    
    Map<String, Object> selector = Collections.singletonMap(
        "address",
        Collections.singletonMap("$regex", "Street"));
    
    PostFindOptions findOptions = new PostFindOptions.Builder()
        .db("users")
        .selector(selector)
        .fields(Arrays.asList("_id", "type", "name", "email", "address"))
        .limit(3)
        .build();
    
    FindResult response =
        service.postFind(findOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the getUserByAddress Cloudant Query "text" index to exist. To create the index, see Create a new index on a database.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    const service = CloudantV1.newInstance({});
    
    const selector: CloudantV1.JsonObject = {
      email_verified: {
        '$eq': true
      }
    };
    
    const sort: CloudantV1.JsonObject = {
      email: 'desc'
    };
    
    service.postFind({
      db: 'users',
      selector: selector,
      fields: ['_id', 'type', 'name', 'email'],
      sort: [sort],
      limit: 3
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the getUserByEmail Cloudant Query "json" index to exist. To create the index, see Create a new index on a database.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    const service = CloudantV1.newInstance({});
    
    const selector: CloudantV1.JsonObject = {
      address: {
        '$regex': 'Street'
      }
    };
    
    service.postFind({
      db: 'users',
      selector: selector,
      fields: ['_id', 'type', 'name', 'email', 'address'],
      limit: 3
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the getUserByAddress Cloudant Query "text" index to exist. To create the index, see Create a new index on a database.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_find(
      db='users',
      selector={'email_verified': {'$eq': True}},
      fields=["_id", "type", "name", "email"],
      sort=[{'email': 'desc'}],
      limit=3
    ).get_result()
    print(response)
    

    This example requires the getUserByAddress Cloudant Query "json" index to exist. To create the index, see Create a new index on a database.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_find(
      db='users',
      selector={'address': {'$regex': 'Street'}},
      fields=["_id", "type", "name", "email", "address"],
      limit=3
    ).get_result()
    print(response)
    

    This example requires the getUserByVerifiedEmail Cloudant Query "text" index to exist. To create the index, see Create a new index on a database.

Response

Response type for PostFind: FindResult

Response type for PostFindAsStream: io.ReadCloser

Response type for postFind: FindResult

Response type for postFindAsStream: InputStream

Response type for postFind: FindResult

Response type for postFindAsStream: NodeJS.ReadableStream

Response type for post_find: FindResult

Response type for post_find_as_stream: BinaryIO

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Status Code

  • HTTP response for postFind and postPartitionFind.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example FindResult response.

    {
      "bookmark": "g1AAAABCeJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYqzJSYlGxoZg2Q5YLI5QHFGJMmsLABByhEQ",
      "docs": [
        {
          "_id": "exampleid",
          "description": "A professional, high powered innovative kitchen tool",
          "email": "amelie.smith@aol.com",
          "name": "1100",
          "productid": "1000043",
          "type": "user"
        },
        {
          "_id": "exampleid2",
          "description": "New and improved kitchen blender",
          "email": "bob.smith@aol.com",
          "name": "Pro System 3000",
          "productid": "1000044",
          "type": "user"
        }
      ],
      "execution_stats": {
        "execution_time_ms": 4.37,
        "results_returned": 2,
        "total_docs_examined": 4,
        "total_keys_examined": 0,
        "total_quorum_docs_examined": 0
      }
    }
  • Example FindResult response.

    {
      "bookmark": "g1AAAABCeJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYqzJSYlGxoZg2Q5YLI5QHFGJMmsLABByhEQ",
      "docs": [
        {
          "_id": "exampleid",
          "description": "A professional, high powered innovative kitchen tool",
          "email": "amelie.smith@aol.com",
          "name": "1100",
          "productid": "1000043",
          "type": "user"
        },
        {
          "_id": "exampleid2",
          "description": "New and improved kitchen blender",
          "email": "bob.smith@aol.com",
          "name": "Pro System 3000",
          "productid": "1000044",
          "type": "user"
        }
      ],
      "execution_stats": {
        "execution_time_ms": 4.37,
        "results_returned": 2,
        "total_docs_examined": 4,
        "total_keys_examined": 0,
        "total_quorum_docs_examined": 0
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about all indexes

When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.

When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.

When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.

When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.

When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.

GET /{db}/_index
(cloudant *CloudantV1) GetIndexesInformation(getIndexesInformationOptions *GetIndexesInformationOptions) (result *IndexesInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetIndexesInformationWithContext(ctx context.Context, getIndexesInformationOptions *GetIndexesInformationOptions) (result *IndexesInformation, response *core.DetailedResponse, err error)
ServiceCall<IndexesInformation> getIndexesInformation(GetIndexesInformationOptions getIndexesInformationOptions)
getIndexesInformation(params)
get_indexes_information(
        self,
        db: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the GetIndexesInformationOptions struct and set the fields to provide parameter values for the GetIndexesInformation method.

Use the GetIndexesInformationOptions.Builder to create a GetIndexesInformationOptions object that contains the parameter values for the getIndexesInformation method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

WithContext method only

The GetIndexesInformation options.

The getIndexesInformation options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/users/_index"
    
  • getIndexesInformationOptions := service.NewGetIndexesInformationOptions(
      "users",
    )
    
    indexesInformation, response, err := service.GetIndexesInformation(getIndexesInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(indexesInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetIndexesInformationOptions;
    import com.ibm.cloud.cloudant.v1.model.IndexesInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    GetIndexesInformationOptions indexesInformationOptions =
        new GetIndexesInformationOptions.Builder()
            .db("users")
            .build();
    
    IndexesInformation response =
        service.getIndexesInformation(indexesInformationOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getIndexesInformation({
      db: 'users'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_indexes_information(
      db='users'
    ).get_result()
    
    print(response)
    

Response

Schema for information about the indexes in a database.

Schema for information about the indexes in a database.

Schema for information about the indexes in a database.

Schema for information about the indexes in a database.

Schema for information about the indexes in a database.

Status Code

  • HTTP response for /{db}/_index style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example IndexInformation response.

    {
      "indexes": [
        {
          "ddoc": null,
          "def": {
            "fields": [
              {
                "_id": "asc"
              }
            ]
          },
          "name": "_all_docs",
          "type": "special"
        },
        {
          "ddoc": "_design/json-index",
          "def": {
            "fields": [
              {
                "name": "asc"
              }
            ]
          },
          "name": "getUserByName",
          "partitioned": false,
          "type": "json"
        }
      ],
      "total_rows": 2
    }
  • Example IndexInformation response.

    {
      "indexes": [
        {
          "ddoc": null,
          "def": {
            "fields": [
              {
                "_id": "asc"
              }
            ]
          },
          "name": "_all_docs",
          "type": "special"
        },
        {
          "ddoc": "_design/json-index",
          "def": {
            "fields": [
              {
                "name": "asc"
              }
            ]
          },
          "name": "getUserByName",
          "partitioned": false,
          "type": "json"
        }
      ],
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for information about all indexes

Retrieves the HTTP headers for information about all indexes.

HEAD /{db}/_index

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_index style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create a new index on a database

Create a new index on a database.

Create a new index on a database.

Create a new index on a database.

Create a new index on a database.

Create a new index on a database.

POST /{db}/_index
(cloudant *CloudantV1) PostIndex(postIndexOptions *PostIndexOptions) (result *IndexResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostIndexWithContext(ctx context.Context, postIndexOptions *PostIndexOptions) (result *IndexResult, response *core.DetailedResponse, err error)
ServiceCall<IndexResult> postIndex(PostIndexOptions postIndexOptions)
postIndex(params)
post_index(
        self,
        db: str,
        index: 'IndexDefinition',
        *,
        ddoc: Optional[str] = None,
        name: Optional[str] = None,
        partitioned: Optional[bool] = None,
        type: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.design-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.design-document.write

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostIndexOptions struct and set the fields to provide parameter values for the PostIndex method.

Use the PostIndexOptions.Builder to create a PostIndexOptions object that contains the parameter values for the postIndex method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postIndex.

Examples:
IndexConfiguration

WithContext method only

The PostIndex options.

The postIndex options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a json or text query index definition. Indexes of type text have additional configuration properties that do not apply to json indexes, these are:

    • default_analyzer - the default text analyzer to use * default_field - whether to index the text in all document fields and what analyzer to use for that purpose.
  • Specifies the design document name in which the index will be created. The design document name is the design document ID excluding the _design/ prefix.

  • name.

  • The default value is true for databases with partitioned: true and false otherwise. For databases with partitioned: false if this option is specified the value must be false.

  • Schema for the type of an index.

    Allowable values: [json,special,text]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a json or text query index definition. Indexes of type text have additional configuration properties that do not apply to json indexes, these are:

    • default_analyzer - the default text analyzer to use * default_field - whether to index the text in all document fields and what analyzer to use for that purpose.
  • Specifies the design document name in which the index will be created. The design document name is the design document ID excluding the _design/ prefix.

  • name.

  • The default value is true for databases with partitioned: true and false otherwise. For databases with partitioned: false if this option is specified the value must be false.

  • Schema for the type of an index.

    Allowable values: [json,special,text]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_index" -H "Content-Type: application/json" --data '{
        "ddoc": "json-index",
        "index": {
          "fields": [{
            "email": "asc"
          }]
        },
        "name": "getUserByEmail",
        "type": "json"
    }'
    

    Type "json" index fields require an object that maps the name of a field to a sort direction.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_index" -H "Content-Type: application/json" --data '{
        "ddoc": "text-index",
        "index": {
          "fields": [{
            "name": "address",
            "type": "string"
          }]
        },
        "name": "getUserByAddress",
        "type": "text"
    }'
    

    Type "text" index fields require an object with a name and type properties for the field.

  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    // Type "json" index fields require an object that maps the name of a field to a sort direction.
    var indexField cloudantv1.IndexField
    indexField.SetProperty("email", core.StringPtr("asc"))
    
    postIndexOptions := service.NewPostIndexOptions(
      "users",
      &cloudantv1.IndexDefinition{
        Fields: []cloudantv1.IndexField{
          indexField,
        },
      },
    )
    postIndexOptions.SetDdoc("json-index")
    postIndexOptions.SetName("getUserByEmail")
    postIndexOptions.SetType("json")
    
    indexResult, response, err := service.PostIndex(postIndexOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(indexResult, "", "  ")
    fmt.Println(string(b))
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    // Type "text" index fields require an object with a name and type properties for the field.
    var indexField cloudantv1.IndexField
    indexField.SetProperty("name", core.StringPtr("address"))
    indexField.SetProperty("type", core.StringPtr("string"))
    
    postIndexOptions := service.NewPostIndexOptions(
      "users",
      &cloudantv1.IndexDefinition{
        Fields: []cloudantv1.IndexField{
          indexField,
        },
      },
    )
    postIndexOptions.SetDdoc("text-index")
    postIndexOptions.SetName("getUserByAddress")
    postIndexOptions.SetType("text")
    
    indexResult, response, err := service.PostIndex(postIndexOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(indexResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.IndexDefinition;
    import com.ibm.cloud.cloudant.v1.model.IndexField;
    import com.ibm.cloud.cloudant.v1.model.IndexResult;
    import com.ibm.cloud.cloudant.v1.model.PostIndexOptions;
    
    Cloudant service = Cloudant.newInstance();
    // Type "json" index fields require an object that maps the name of a field to a sort direction.
    
    IndexField field = new IndexField.Builder()
        .add("email", "asc")
        .build();
    
    IndexDefinition indexDefinition = new IndexDefinition.Builder()
        .addFields(field)
        .build();
    
    PostIndexOptions indexOptions = new PostIndexOptions.Builder()
        .db("users")
        .ddoc("json-index")
        .index(indexDefinition)
        .name("getUserByEmail")
        .type("json")
        .build();
    
    IndexResult response =
        service.postIndex(indexOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.IndexDefinition;
    import com.ibm.cloud.cloudant.v1.model.IndexField;
    import com.ibm.cloud.cloudant.v1.model.IndexResult;
    import com.ibm.cloud.cloudant.v1.model.PostIndexOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    // Type "text" index fields require an object with a name and type properties for the field.
    IndexField field = new IndexField.Builder()
        .add("name", "address")
        .add("type", "string")
        .build();
    
    IndexDefinition indexDefinition = new IndexDefinition.Builder()
        .addFields(field)
        .build();
    
    PostIndexOptions indexOptions = new PostIndexOptions.Builder()
        .db("users")
        .ddoc("text-index")
        .index(indexDefinition)
        .name("getUserByAddress")
        .type("text")
        .build();
    
    IndexResult response =
        service.postIndex(indexOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    // Type "json" index fields require an object that maps the name of a field to a sort direction.
    const indexField: CloudantV1.IndexField = {
      email: 'asc'
    }
    
    const index: CloudantV1.IndexDefinition = {
      fields: [indexField]
    }
    
    service.postIndex({
      db: 'users',
      ddoc: 'json-index',
      name: 'getUserByEmail',
      index: index,
      type: 'json'
    }).then(response => {
      console.log(response.result);
    });
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    // Type "text" index fields require an object with a name and type properties for the field.
    const indexField: CloudantV1.IndexField = {
      name: 'address',
      type: 'string'
    }
    
    const index: CloudantV1.IndexDefinition = {
      fields: [indexField]
    }
    
    service.postIndex({
      db: 'users',
      ddoc: 'text-index',
      name: 'getUserByAddress',
      index: index,
      type: 'text'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1, IndexDefinition, IndexField
    
    service = CloudantV1.new_instance()
    
    # Type "json" index fields require an object that maps the name of a field to a sort direction.
    index_field = IndexField(
      email="asc"
    )
    index = IndexDefinition(
      fields=[index_field]
    )
    
    response = service.post_index(
      db='users',
      ddoc='json-index',
      name='getUserByEmail',
      index=index,
      type='json'
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import CloudantV1, IndexDefinition, IndexField
    
    service = CloudantV1.new_instance()
    
    # Type "text" index fields require an object with a name and type properties for the field.
    index_field = IndexField(
      name="address",
      type="string"
    )
    index = IndexDefinition(
      fields=[index_field]
    )
    
    response = service.post_index(
      db='users',
      ddoc='text-index',
      name='getUserByAddress',
      index=index,
      type='text'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of creating an index.

Schema for the result of creating an index.

Schema for the result of creating an index.

Schema for the result of creating an index.

Schema for the result of creating an index.

Status Code

  • HTTP response for postIndex.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example IndexResult response.

    {
      "id": "_design/json-index",
      "name": "getUserByName",
      "result": "created"
    }
  • Example IndexResult response.

    {
      "id": "_design/json-index",
      "name": "getUserByName",
      "result": "created"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete an index

DELETE /{db}/_index/_design/{ddoc}/{type}/{index}
(cloudant *CloudantV1) DeleteIndex(deleteIndexOptions *DeleteIndexOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteIndexWithContext(ctx context.Context, deleteIndexOptions *DeleteIndexOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> deleteIndex(DeleteIndexOptions deleteIndexOptions)
deleteIndex(params)
delete_index(
        self,
        db: str,
        ddoc: str,
        type: str,
        index: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.design-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.design-document.write

Rate limit

This operation consumes one global query request.

Request

Instantiate the DeleteIndexOptions struct and set the fields to provide parameter values for the DeleteIndex method.

Use the DeleteIndexOptions.Builder to create a DeleteIndexOptions object that contains the parameter values for the deleteIndex method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index type.

    Allowable values: [json,special,text]

  • Path parameter to specify the index name.

WithContext method only

The DeleteIndex options.

The deleteIndex options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index type.

    Allowable values: [json,special,text]

  • Path parameter to specify the index name.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index type.

    Allowable values: [json,special,text]

  • Path parameter to specify the index name.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/users/_index/_design/json-index/json/getUserByName"
    

    This example will fail if getUserByName index doesn't exist. To create the index, see Create a new index on a database.

  • deleteIndexOptions := service.NewDeleteIndexOptions(
      "users",
      "json-index",
      "json",
      "getUserByName",
    )
    
    ok, response, err := service.DeleteIndex(deleteIndexOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(ok, "", "  ")
    fmt.Println(string(b))
    

    This example will fail if getUserByName index doesn't exist. To create the index, see Create a new index on a database.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteIndexOptions;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteIndexOptions indexOptions = new DeleteIndexOptions.Builder()
        .db("users")
        .ddoc("json-index")
        .index("getUserByName")
        .type("json")
        .build();
    
    Ok response =
        service.deleteIndex(indexOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example will fail if getUserByName index doesn't exist. To create the index, see Create a new index on a database.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.deleteIndex({
      db: 'users',
      ddoc: 'json-index',
      index: 'getUserByName',
      type: 'json'
    }).then(response => {
      console.log(response.result);
    });
    

    This example will fail if getUserByName index doesn't exist. To create the index, see Create a new index on a database.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_index(
      db='users',
      ddoc='json-index',
      index='getUserByName',
      type='json'
    ).get_result()
    
    print(response)
    

    This example will fail if getUserByName index doesn't exist. To create the index, see Create a new index on a database.

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about which partition index is used for a query

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

POST /{db}/_partition/{partition_key}/_explain
(cloudant *CloudantV1) PostPartitionExplain(postPartitionExplainOptions *PostPartitionExplainOptions) (result *ExplainResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionExplainWithContext(ctx context.Context, postPartitionExplainOptions *PostPartitionExplainOptions) (result *ExplainResult, response *core.DetailedResponse, err error)
ServiceCall<ExplainResult> postPartitionExplain(PostPartitionExplainOptions postPartitionExplainOptions)
postPartitionExplain(params)
post_partition_explain(
        self,
        db: str,
        partition_key: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 1.01 read requests per row read from the index (rounded up). If no rows are read, the minimum cost is 1 read.

Request

Instantiate the PostPartitionExplainOptions struct and set the fields to provide parameter values for the PostPartitionExplain method.

Use the PostPartitionExplainOptions.Builder to create a PostPartitionExplainOptions object that contains the parameter values for the postPartitionExplain method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

HTTP request body for postPartitionFind.

Examples:
PartitionFindQuery

WithContext method only

The PostPartitionExplain options.

The postPartitionExplain options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

Response

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Status Code

  • HTTP response for postExplain.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ExplainResult response.

    {
      "covering": false,
      "dbname": "users",
      "fields": [],
      "index": {
        "ddoc": "_design/id-index",
        "def": {
          "fields": [
            {
              "_id": "asc"
            }
          ]
        },
        "name": "d479bdddf50865e520a0193704c8b93a3bd48f77",
        "type": "json"
      },
      "limit": 10,
      "mrargs": {
        "conflicts": "undefined",
        "direction": "fwd",
        "end_key": [
          "<MAX>"
        ],
        "include_docs": true,
        "partition": null,
        "reduce": false,
        "stable": false,
        "start_key": [],
        "update": true,
        "view_type": "map"
      },
      "opts": {
        "bookmark": "nil",
        "conflicts": false,
        "execution_stats": true,
        "fields": [],
        "limit": 10,
        "partition": "",
        "r": 1,
        "skip": 0,
        "sort": {},
        "stable": false,
        "stale": false,
        "update": false,
        "use_index": []
      },
      "partitioned": true,
      "selector": {
        "type": {
          "$eq": "user"
        }
      },
      "skip": 0
    }
  • Example ExplainResult response.

    {
      "covering": false,
      "dbname": "users",
      "fields": [],
      "index": {
        "ddoc": "_design/id-index",
        "def": {
          "fields": [
            {
              "_id": "asc"
            }
          ]
        },
        "name": "d479bdddf50865e520a0193704c8b93a3bd48f77",
        "type": "json"
      },
      "limit": 10,
      "mrargs": {
        "conflicts": "undefined",
        "direction": "fwd",
        "end_key": [
          "<MAX>"
        ],
        "include_docs": true,
        "partition": null,
        "reduce": false,
        "stable": false,
        "start_key": [],
        "update": true,
        "view_type": "map"
      },
      "opts": {
        "bookmark": "nil",
        "conflicts": false,
        "execution_stats": true,
        "fields": [],
        "limit": 10,
        "partition": "",
        "r": 1,
        "skip": 0,
        "sort": {},
        "stable": false,
        "stale": false,
        "update": false,
        "use_index": []
      },
      "partitioned": true,
      "selector": {
        "type": {
          "$eq": "user"
        }
      },
      "skip": 0
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a database partition index by using selector syntax

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

POST /{db}/_partition/{partition_key}/_find
(cloudant *CloudantV1) PostPartitionFind(postPartitionFindOptions *PostPartitionFindOptions) (result *FindResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionFindWithContext(ctx context.Context, postPartitionFindOptions *PostPartitionFindOptions) (result *FindResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionFindAsStream(postPartitionFindOptions *PostPartitionFindOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<FindResult> postPartitionFind(PostPartitionFindOptions postPartitionFindOptions)
ServiceCall<InputStream> postPartitionFindAsStream(PostPartitionFindOptions postPartitionFindOptions)
postPartitionFind(params)
postPartitionFindAsStream(params)
post_partition_find(
        self,
        db: str,
        partition_key: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse
post_partition_find_as_stream(
        self,
        db: str,
        partition_key: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 1.01 read requests per row read from the index (rounded up). If no rows are read, the minimum cost is 1 read.

Request

Instantiate the PostPartitionFindOptions struct and set the fields to provide parameter values for the PostPartitionFind method.

Use the PostPartitionFindOptions.Builder to create a PostPartitionFindOptions object that contains the parameter values for the postPartitionFind method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

HTTP request body for postPartitionFind.

Examples:
PartitionFindQuery

WithContext method only

The PostPartitionFind options.

The postPartitionFind options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products/_partition/small-appliances/_find" -H "Content-Type: application/json" --data '{
      "fields": [
        "productid",
        "name",
        "description"
      ],
      "selector": {
        "type": {
          "$eq": "product"
        }
      }
    }'
    
  • selector := map[string]interface{}{
      "type": map[string]string{
        "$eq": "product",
      },
    }
    
    postPartitionFindOptions := service.NewPostPartitionFindOptions(
      "products",
      "small-appliances",
      selector,
    )
    postPartitionFindOptions.SetFields([]string{
      "productid", "name", "description",
    })
    
    findResult, response, err := service.PostPartitionFind(postPartitionFindOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(findResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.FindResult;
    import com.ibm.cloud.cloudant.v1.model.PostPartitionFindOptions;
    
    import java.util.Arrays;
    import java.util.HashMap;
    import java.util.Map;
    
    Cloudant service = Cloudant.newInstance();
    
    Map<String, String> typeEqualsProduct = new HashMap<>();
    typeEqualsProduct.put("$eq", "product");
    
    Map<String, Object> selector = new HashMap<>();
    selector.put("type", typeEqualsProduct);
    
    PostPartitionFindOptions findOptions =
        new PostPartitionFindOptions.Builder()
            .db("products")
            .partitionKey("small-appliances")
            .fields(Arrays.asList("productid", "name", "description"))
            .selector(selector)
            .build();
    
    FindResult response =
        service.postPartitionFind(findOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const selector: CloudantV1.Selector = {
      type: {'$eq': 'product'}
    }
    service.postPartitionFind({
      db: 'products',
      partitionKey: 'small-appliances',
      fields: ['productid', 'name', 'description'],
      selector: selector
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_partition_find(
      db='products',
      partition_key='small-appliances',
      fields=['productid', 'name', 'description'],
      selector={'type': {'$eq': 'product'}}
    ).get_result()
    
    print(response)
    

Response

Response type for PostPartitionFind: FindResult

Response type for PostPartitionFindAsStream: io.ReadCloser

Response type for postPartitionFind: FindResult

Response type for postPartitionFindAsStream: InputStream

Response type for postPartitionFind: FindResult

Response type for postPartitionFindAsStream: NodeJS.ReadableStream

Response type for post_partition_find: FindResult

Response type for post_partition_find_as_stream: BinaryIO

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Status Code

  • HTTP response for postFind and postPartitionFind.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example FindResult response.

    {
      "bookmark": "g1AAAABCeJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYqzJSYlGxoZg2Q5YLI5QHFGJMmsLABByhEQ",
      "docs": [
        {
          "_id": "exampleid",
          "description": "A professional, high powered innovative kitchen tool",
          "email": "amelie.smith@aol.com",
          "name": "1100",
          "productid": "1000043",
          "type": "user"
        },
        {
          "_id": "exampleid2",
          "description": "New and improved kitchen blender",
          "email": "bob.smith@aol.com",
          "name": "Pro System 3000",
          "productid": "1000044",
          "type": "user"
        }
      ],
      "execution_stats": {
        "execution_time_ms": 4.37,
        "results_returned": 2,
        "total_docs_examined": 4,
        "total_keys_examined": 0,
        "total_quorum_docs_examined": 0
      }
    }
  • Example FindResult response.

    {
      "bookmark": "g1AAAABCeJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYqzJSYlGxoZg2Q5YLI5QHFGJMmsLABByhEQ",
      "docs": [
        {
          "_id": "exampleid",
          "description": "A professional, high powered innovative kitchen tool",
          "email": "amelie.smith@aol.com",
          "name": "1100",
          "productid": "1000043",
          "type": "user"
        },
        {
          "_id": "exampleid2",
          "description": "New and improved kitchen blender",
          "email": "bob.smith@aol.com",
          "name": "Pro System 3000",
          "productid": "1000044",
          "type": "user"
        }
      ],
      "execution_stats": {
        "execution_time_ms": 4.37,
        "results_returned": 2,
        "total_docs_examined": 4,
        "total_keys_examined": 0,
        "total_quorum_docs_examined": 0
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query tokenization of sample text (GET)

Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.

GET /_search_analyze

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-search-analyze.execute

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-search-analyze.execute

Rate limit

This operation consumes one global query request.

Request

Query Parameters

  • Query parameter to specify search analyzer type.

    Allowable values: [arabic,armenian,basque,brazilian,bulgarian,catalan,chinese,cjk,classic,czech,danish,dutch,email,english,finnish,french,galician,german,greek,hindi,hungarian,indonesian,irish,italian,japanese,keyword,latvian,norwegian,persian,polish,portuguese,romanian,russian,simple,spanish,standard,swedish,thai,turkish,whitespace]

  • Query parameter to specify search analyzer text.

Response

Schema for the output of testing search analyzer tokenization.

Status Code

  • HTTP response for postSearchAnalyzer.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchAnalyzeResult response.

    {
      "tokens": [
        "run",
        "fun"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query tokenization of sample text

Returns the HTTP headers that contain a minimal amount of information about search analyze.

HEAD /_search_analyze

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-search-analyze.execute

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-search-analyze.execute

Rate limit

This operation consumes one global query request.

Request

Query Parameters

  • Query parameter to specify search analyzer type.

    Allowable values: [arabic,armenian,basque,brazilian,bulgarian,catalan,chinese,cjk,classic,czech,danish,dutch,email,english,finnish,french,galician,german,greek,hindi,hungarian,indonesian,irish,italian,japanese,keyword,latvian,norwegian,persian,polish,portuguese,romanian,russian,simple,spanish,standard,swedish,thai,turkish,whitespace]

  • Query parameter to specify search analyzer text.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for search analyze operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query tokenization of sample text

Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.

Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.

Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.

Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.

Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.

POST /_search_analyze
(cloudant *CloudantV1) PostSearchAnalyze(postSearchAnalyzeOptions *PostSearchAnalyzeOptions) (result *SearchAnalyzeResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostSearchAnalyzeWithContext(ctx context.Context, postSearchAnalyzeOptions *PostSearchAnalyzeOptions) (result *SearchAnalyzeResult, response *core.DetailedResponse, err error)
ServiceCall<SearchAnalyzeResult> postSearchAnalyze(PostSearchAnalyzeOptions postSearchAnalyzeOptions)
postSearchAnalyze(params)
post_search_analyze(
        self,
        analyzer: str,
        text: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-search-analyze.execute

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-search-analyze.execute

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostSearchAnalyzeOptions struct and set the fields to provide parameter values for the PostSearchAnalyze method.

Use the PostSearchAnalyzeOptions.Builder to create a PostSearchAnalyzeOptions object that contains the parameter values for the postSearchAnalyze method.

HTTP request body for postSearchAnalyze.

Examples:
SearchAnalyzeQuery

WithContext method only

The PostSearchAnalyze options.

The postSearchAnalyze options.

parameters

  • The analyzer type that is being used at the tokenization.

    Allowable values: [arabic,armenian,basque,brazilian,bulgarian,catalan,chinese,cjk,classic,czech,danish,dutch,email,english,finnish,french,galician,german,greek,hindi,hungarian,indonesian,irish,italian,japanese,keyword,latvian,norwegian,persian,polish,portuguese,romanian,russian,simple,spanish,standard,swedish,thai,turkish,whitespace]

  • The text to tokenize with the analyzer.

parameters

  • The analyzer type that is being used at the tokenization.

    Allowable values: [arabic,armenian,basque,brazilian,bulgarian,catalan,chinese,cjk,classic,czech,danish,dutch,email,english,finnish,french,galician,german,greek,hindi,hungarian,indonesian,irish,italian,japanese,keyword,latvian,norwegian,persian,polish,portuguese,romanian,russian,simple,spanish,standard,swedish,thai,turkish,whitespace]

  • The text to tokenize with the analyzer.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/_search_analyze" -H "Content-Type: application/json" --data '{
      "analyzer": "english",
      "text": "running is fun"
    }'
    
  • postSearchAnalyzeOptions := service.NewPostSearchAnalyzeOptions(
      "english",
      "running is fun",
    )
    
    searchAnalyzeResult, response, err := service.PostSearchAnalyze(postSearchAnalyzeOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(searchAnalyzeResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostSearchAnalyzeOptions;
    import com.ibm.cloud.cloudant.v1.model.SearchAnalyzeResult;
    
    Cloudant service = Cloudant.newInstance();
    
    PostSearchAnalyzeOptions searchAnalyzerOptions =
        new PostSearchAnalyzeOptions.Builder()
            .analyzer("english")
            .text("running is fun")
            .build();
    
    SearchAnalyzeResult response =
        service.postSearchAnalyze(searchAnalyzerOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postSearchAnalyze({
      analyzer: 'english',
      text: 'running is fun',
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_search_analyze(
      analyzer='english',
      text='running is fun'
    ).get_result()
    
    print(response)
    

Response

Schema for the output of testing search analyzer tokenization.

Schema for the output of testing search analyzer tokenization.

Schema for the output of testing search analyzer tokenization.

Schema for the output of testing search analyzer tokenization.

Schema for the output of testing search analyzer tokenization.

Status Code

  • HTTP response for postSearchAnalyzer.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchAnalyzeResult response.

    {
      "tokens": [
        "run",
        "fun"
      ]
    }
  • Example SearchAnalyzeResult response.

    {
      "tokens": [
        "run",
        "fun"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a search index (GET)

Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines search indexes, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index.

GET /{db}/_design/{ddoc}/_search/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Query Parameters

  • Query parameter to specify a Lucene search query. Alias of q.

  • Query parameter to specify a bookmark that was received from a previous request. This parameter enables paging through the results. If there are no more results after the bookmark, you get a response containing no further results and the same bookmark, confirming the end of the result list.

  • Query parameter to specify an array of names of string fields, for which counts are requested. The response contains counts for each unique value of the string field name among the documents that match the search query. Faceting must be enabled for this parameter to function.

  • Restrict results to documents with a dimension equal to the specified label(s). The search matches only documents containing the value that was provided in the named field. It differs from using "fieldname:value" in the q parameter only in that the values are not analyzed. Faceting must be enabled for this parameter to function.

  • Query parameter to specify the field name by which to group search matches. It must be a string that contains the name of a string field. Fields containing other data such as numbers, objects, or arrays cannot be used.

  • Query parameter to specify the maximum group count. This parameter can be used only if group_field is specified.

    Possible values: 1 ≤ value ≤ 4294967295

  • Query parameter to specify the order of the groups in a search that uses group_field. The default sort order is relevance. This parameter can have the same values as the sort field, so single fields and arrays of fields are supported.

  • Query parameter to specify which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Query parameter to specify a string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Query parameter to specify a string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • Query parameter to specify the number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • Query parameter to specify the number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify a JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify ranges for faceted, numeric search fields. The value is a JSON object where the fields names are faceted numeric search fields, and the values of the fields are JSON objects. For each of these objects the field names of the JSON objects are names for ranges. The values are strings that describe the range, for example "[0 TO 10]".

  • Query parameter to specify the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or -fieldname<type> for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression ^-?[^<>]+(<(?:string|number)>)?$

  • Query parameter to specify to not wait for the index to finish building before returning results.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/users/_design/allusers/_search/activeUsers?query=name:Jane*%20AND%20active:True"
    

    This example requires the activeUsers Cloudant Search index to exist. To create the design document with this index, see Create or modify a design document.

Response

Schema for the result of a query search operation.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a queried search index (GET)

Retrieves the HTTP headers for a queried search index (GET).

HEAD /{db}/_design/{ddoc}/_search/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a search index

Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

POST /{db}/_design/{ddoc}/_search/{index}
(cloudant *CloudantV1) PostSearch(postSearchOptions *PostSearchOptions) (result *SearchResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostSearchWithContext(ctx context.Context, postSearchOptions *PostSearchOptions) (result *SearchResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostSearchAsStream(postSearchOptions *PostSearchOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<SearchResult> postSearch(PostSearchOptions postSearchOptions)
ServiceCall<InputStream> postSearchAsStream(PostSearchOptions postSearchOptions)
postSearch(params)
postSearchAsStream(params)
post_search(
        self,
        db: str,
        ddoc: str,
        index: str,
        query: str,
        *,
        bookmark: Optional[str] = None,
        highlight_fields: Optional[List[str]] = None,
        highlight_number: Optional[int] = None,
        highlight_post_tag: Optional[str] = None,
        highlight_pre_tag: Optional[str] = None,
        highlight_size: Optional[int] = None,
        include_docs: Optional[bool] = None,
        include_fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        sort: Optional[List[str]] = None,
        stale: Optional[str] = None,
        counts: Optional[List[str]] = None,
        drilldown: Optional[List[List[str]]] = None,
        group_field: Optional[str] = None,
        group_limit: Optional[int] = None,
        group_sort: Optional[List[str]] = None,
        ranges: Optional[dict] = None,
        **kwargs,
    ) -> DetailedResponse
post_search_as_stream(
        self,
        db: str,
        ddoc: str,
        index: str,
        query: str,
        *,
        bookmark: Optional[str] = None,
        highlight_fields: Optional[List[str]] = None,
        highlight_number: Optional[int] = None,
        highlight_post_tag: Optional[str] = None,
        highlight_pre_tag: Optional[str] = None,
        highlight_size: Optional[int] = None,
        include_docs: Optional[bool] = None,
        include_fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        sort: Optional[List[str]] = None,
        stale: Optional[str] = None,
        counts: Optional[List[str]] = None,
        drilldown: Optional[List[List[str]]] = None,
        group_field: Optional[str] = None,
        group_limit: Optional[int] = None,
        group_sort: Optional[List[str]] = None,
        ranges: Optional[dict] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one global query request.

Request

Instantiate the PostSearchOptions struct and set the fields to provide parameter values for the PostSearch method.

Use the PostSearchOptions.Builder to create a PostSearchOptions object that contains the parameter values for the postSearch method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

HTTP request body for postSearch.

Examples:
SearchQuery

WithContext method only

The PostSearch options.

The postSearch options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index name.

  • The Lucene query to execute.

  • Opaque bookmark token used when paginating results.

  • Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • A string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • A string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Include the full content of the documents in the return.

    Default: false

  • A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Limit the number of the returned documents to the specified number.

    Possible values: 0 ≤ value ≤ 200

  • Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or "-fieldname<type>" for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression /^-?[^<>]+(<(?:string|number)>)?$/

  • Do not wait for the index to finish building to return results.

    Allowable values: [ok]

  • This field defines an array of names of string fields, for which counts are requested. The response contains counts for each unique value of this field name among the documents that match the search query. Faceting must be enabled for this parameter to function. This option is only available when making global queries.

  • Restrict results to documents with a dimension equal to the specified label(s). The search matches only documents containing the value that was provided in the named field. It differs from using "fieldname:value" in the q parameter only in that the values are not analyzed. Faceting must be enabled for this parameter to function.

  • Field by which to group search matches. A string that contains the name of a string field. Fields containing other data such as numbers, objects, or arrays cannot be used. This option is only available when making global queries.

  • Maximum group count. This field can be used only if group_field is specified. This option is only available when making global queries.

    Possible values: 1 ≤ value ≤ 4294967295

  • This field defines the order of the groups in a search that uses group_field. The default sort order is relevance. This field can have the same values as the sort field, so single fields and arrays of fields are supported. This option is only available when making global queries.

  • This field defines ranges for faceted, numeric search fields. The value is a JSON object where the fields names are faceted numeric search fields, and the values of the fields are JSON objects. The field names of the JSON objects are names for ranges. The values are strings that describe the range, for example "[0 TO 10]". This option is only available when making global queries.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index name.

  • The Lucene query to execute.

  • Opaque bookmark token used when paginating results.

  • Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • A string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • A string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Include the full content of the documents in the return.

    Default: false

  • A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Limit the number of the returned documents to the specified number.

    Possible values: 0 ≤ value ≤ 200

  • Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or "-fieldname<type>" for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression /^-?[^<>]+(<(?:string|number)>)?$/

  • Do not wait for the index to finish building to return results.

    Allowable values: [ok]

  • This field defines an array of names of string fields, for which counts are requested. The response contains counts for each unique value of this field name among the documents that match the search query. Faceting must be enabled for this parameter to function. This option is only available when making global queries.

  • Restrict results to documents with a dimension equal to the specified label(s). The search matches only documents containing the value that was provided in the named field. It differs from using "fieldname:value" in the q parameter only in that the values are not analyzed. Faceting must be enabled for this parameter to function.

  • Field by which to group search matches. A string that contains the name of a string field. Fields containing other data such as numbers, objects, or arrays cannot be used. This option is only available when making global queries.

  • Maximum group count. This field can be used only if group_field is specified. This option is only available when making global queries.

    Possible values: 1 ≤ value ≤ 4294967295

  • This field defines the order of the groups in a search that uses group_field. The default sort order is relevance. This field can have the same values as the sort field, so single fields and arrays of fields are supported. This option is only available when making global queries.

  • This field defines ranges for faceted, numeric search fields. The value is a JSON object where the fields names are faceted numeric search fields, and the values of the fields are JSON objects. The field names of the JSON objects are names for ranges. The values are strings that describe the range, for example "[0 TO 10]". This option is only available when making global queries.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/users/_design/allusers/_search/activeUsers" --data '{
      "query": "name:Jane* AND active:True"
    }'
    

    This example requires the activeUsers Cloudant Search index to exist. To create the design document with this index, see Create or modify a design document.

  • postSearchOptions := service.NewPostSearchOptions(
      "users",
      "allusers",
      "activeUsers",
      "name:Jane* AND active:True",
    )
    
    searchResult, response, err := service.PostSearch(postSearchOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(searchResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the activeUsers Cloudant Search index to exist. To create the design document with this index, see Create or modify a design document.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostSearchOptions;
    import com.ibm.cloud.cloudant.v1.model.SearchResult;
    
    Cloudant service = Cloudant.newInstance();
    
    PostSearchOptions searchOptions = new PostSearchOptions.Builder()
        .db("users")
        .ddoc("allusers")
        .index("activeUsers")
        .query("name:Jane* AND active:True")
        .build();
    
    SearchResult response =
        service.postSearch(searchOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the activeUsers Cloudant Search index to exist. To create the design document with this index, see Create or modify a design document.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postSearch({
      db: 'users',
      ddoc: 'allusers',
      index: 'activeUsers',
      query: 'name:Jane* AND active:True'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the activeUsers Cloudant Search index to exist. To create the design document with this index, see Create or modify a design document.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_search(
      db='users',
      ddoc='allusers',
      index='activeUsers',
      query='name:Jane* AND active:True'
    ).get_result()
    
    print(response)
    

    This example requires the activeUsers Cloudant Search index to exist. To create the design document with this index, see Create or modify a design document.

Response

Response type for PostSearch: SearchResult

Response type for PostSearchAsStream: io.ReadCloser

Response type for postSearch: SearchResult

Response type for postSearchAsStream: InputStream

Response type for postSearch: SearchResult

Response type for postSearchAsStream: NodeJS.ReadableStream

Response type for post_search: SearchResult

Response type for post_search_as_stream: BinaryIO

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about a search index

Retrieve search index metadata information, such as the size of the index on disk.

Retrieve search index metadata information, such as the size of the index on disk.

Retrieve search index metadata information, such as the size of the index on disk.

Retrieve search index metadata information, such as the size of the index on disk.

Retrieve search index metadata information, such as the size of the index on disk.

GET /{db}/_design/{ddoc}/_search_info/{index}
(cloudant *CloudantV1) GetSearchInfo(getSearchInfoOptions *GetSearchInfoOptions) (result *SearchInfoResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSearchInfoWithContext(ctx context.Context, getSearchInfoOptions *GetSearchInfoOptions) (result *SearchInfoResult, response *core.DetailedResponse, err error)
ServiceCall<SearchInfoResult> getSearchInfo(GetSearchInfoOptions getSearchInfoOptions)
getSearchInfo(params)
get_search_info(
        self,
        db: str,
        ddoc: str,
        index: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Instantiate the GetSearchInfoOptions struct and set the fields to provide parameter values for the GetSearchInfo method.

Use the GetSearchInfoOptions.Builder to create a GetSearchInfoOptions object that contains the parameter values for the getSearchInfo method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

WithContext method only

The GetSearchInfo options.

The getSearchInfo options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index name.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index name.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_design/appliances/_search_info/findByPrice"
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • getSearchInfoOptions := service.NewGetSearchInfoOptions(
      "products",
      "appliances",
      "findByPrice",
    )
    
    searchInfoResult, response, err := service.GetSearchInfo(getSearchInfoOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(searchInfoResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetSearchInfoOptions;
    import com.ibm.cloud.cloudant.v1.model.SearchInfoResult;
    
    Cloudant service = Cloudant.newInstance();
    
    GetSearchInfoOptions infoOptions =
        new GetSearchInfoOptions.Builder()
            .db("products")
            .ddoc("appliances")
            .index("findByPrice")
            .build();
    
    SearchInfoResult response =
        service.getSearchInfo(infoOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getSearchInfo({
      db: 'products',
      ddoc: 'appliances',
      index: 'findByPrice'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_search_info(
      db='products',
      ddoc='appliances',
      index='findByPrice'
    ).get_result()
    
    print(response)
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

Response

Schema for search index information.

Schema for search index information.

Schema for search index information.

Schema for search index information.

Schema for search index information.

Status Code

  • HTTP response for search index info operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchInfoResult response.

    {
      "name": "_design/appliances/findByPrice",
      "search_index": {
        "committed_seq": 47,
        "disk_size": 2889,
        "doc_count": 3,
        "doc_del_count": 0,
        "pending_seq": 47
      }
    }
  • Example SearchInfoResult response.

    {
      "name": "_design/appliances/findByPrice",
      "search_index": {
        "committed_seq": 47,
        "disk_size": 2889,
        "doc_count": 3,
        "doc_del_count": 0,
        "pending_seq": 47
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for information about a search index

Retrieves the HTTP headers for a search index.

HEAD /{db}/_design/{ddoc}/_search_info/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for search index info operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a database partition search index (GET)

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

GET /{db}/_partition/{partition_key}/_design/{ddoc}/_search/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Query Parameters

  • Query parameter to specify a Lucene search query. Alias of q.

  • Query parameter to specify a bookmark that was received from a previous request. This parameter enables paging through the results. If there are no more results after the bookmark, you get a response containing no further results and the same bookmark, confirming the end of the result list.

  • Query parameter to specify which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Query parameter to specify a string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Query parameter to specify a string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • Query parameter to specify the number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • Query parameter to specify the number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify a JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or -fieldname<type> for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression ^-?[^<>]+(<(?:string|number)>)?$

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances/_design/appliances/_search/findByPrice?query=price:[14%20TO%2020]"
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

Response

Schema for the result of a query search operation.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a database partition search index (GET)

Retrieves the HTTP headers for a database partition search index (GET)."

HEAD /{db}/_partition/{partition_key}/_design/{ddoc}/_search/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve information about a database partition

Given a partition key, return the database name, sizes, partition, doc count, and doc delete count.

Given a partition key, return the database name, sizes, partition, doc count, and doc delete count.

Given a partition key, return the database name, sizes, partition, doc count, and doc delete count.

Given a partition key, return the database name, sizes, partition, doc count, and doc delete count.

Given a partition key, return the database name, sizes, partition, doc count, and doc delete count.

GET /{db}/_partition/{partition_key}
(cloudant *CloudantV1) GetPartitionInformation(getPartitionInformationOptions *GetPartitionInformationOptions) (result *PartitionInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetPartitionInformationWithContext(ctx context.Context, getPartitionInformationOptions *GetPartitionInformationOptions) (result *PartitionInformation, response *core.DetailedResponse, err error)
ServiceCall<PartitionInformation> getPartitionInformation(GetPartitionInformationOptions getPartitionInformationOptions)
getPartitionInformation(params)
get_partition_information(
        self,
        db: str,
        partition_key: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Instantiate the GetPartitionInformationOptions struct and set the fields to provide parameter values for the GetPartitionInformation method.

Use the GetPartitionInformationOptions.Builder to create a GetPartitionInformationOptions object that contains the parameter values for the getPartitionInformation method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

WithContext method only

The GetPartitionInformation options.

The getPartitionInformation options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances" -H "Content-Type: application/json"
    
  • getPartitionInformationOptions := service.NewGetPartitionInformationOptions(
      "products",
      "small-appliances",
    )
    
    partitionInformation, response, err := service.GetPartitionInformation(getPartitionInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(partitionInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.model.GetPartitionInformationOptions;
    import com.ibm.cloud.cloudant.v1.model.PartitionInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    GetPartitionInformationOptions informationOptions =
        new GetPartitionInformationOptions.Builder()
            .db("products")
            .partitionKey("small-appliances")
            .build();
    
    PartitionInformation response =
        service.getPartitionInformation(informationOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getPartitionInformation({
      db: 'products',
      partitionKey: 'small-appliances'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_partition_information(
      db='products',
      partition_key='small-appliances'
    ).get_result()
    
    print(response)
    

Response

Schema for information about a database partition.

Schema for information about a database partition.

Schema for information about a database partition.

Schema for information about a database partition.

Schema for information about a database partition.

Status Code

  • HTTP response for /{db}/_partition/{partition_key} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example PartitionInformation response.

    {
      "info": {
        "db_name": "products",
        "doc_count": 3,
        "doc_del_count": 1,
        "partition": "small-appliances",
        "partitioned_indexes": {
          "count": 1,
          "indexes": {
            "search": 0,
            "view": 1
          },
          "limit": 10
        },
        "sizes": {
          "active": 1539,
          "external": 1286
        }
      }
    }
  • Example PartitionInformation response.

    {
      "info": {
        "db_name": "products",
        "doc_count": 3,
        "doc_del_count": 1,
        "partition": "small-appliances",
        "partitioned_indexes": {
          "count": 1,
          "indexes": {
            "search": 0,
            "view": 1
          },
          "limit": 10
        },
        "sizes": {
          "active": 1539,
          "external": 1286
        }
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for information about a database partition

Retrieves the HTTP headers for information about a database partition.

HEAD /{db}/_partition/{partition_key}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_partition/{partition_key} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a list of all documents in a database partition (GET)

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

GET /{db}/_partition/{partition_key}/_all_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances/_all_docs?include_docs=true"
    

Response

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a list of all documents in a database partition (GET)

Retrieves the HTTP headers for a list of all documents in a database partition (GET).

HEAD /{db}/_partition/{partition_key}/_all_docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a list of all documents in a database partition

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

POST /{db}/_partition/{partition_key}/_all_docs
(cloudant *CloudantV1) PostPartitionAllDocs(postPartitionAllDocsOptions *PostPartitionAllDocsOptions) (result *AllDocsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionAllDocsWithContext(ctx context.Context, postPartitionAllDocsOptions *PostPartitionAllDocsOptions) (result *AllDocsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionAllDocsAsStream(postPartitionAllDocsOptions *PostPartitionAllDocsOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<AllDocsResult> postPartitionAllDocs(PostPartitionAllDocsOptions postPartitionAllDocsOptions)
ServiceCall<InputStream> postPartitionAllDocsAsStream(PostPartitionAllDocsOptions postPartitionAllDocsOptions)
postPartitionAllDocs(params)
postPartitionAllDocsAsStream(params)
post_partition_all_docs(
        self,
        db: str,
        partition_key: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[str] = None,
        key: Optional[str] = None,
        keys: Optional[List[str]] = None,
        start_key: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_partition_all_docs_as_stream(
        self,
        db: str,
        partition_key: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[str] = None,
        key: Optional[str] = None,
        keys: Optional[List[str]] = None,
        start_key: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Instantiate the PostPartitionAllDocsOptions struct and set the fields to provide parameter values for the PostPartitionAllDocs method.

Use the PostPartitionAllDocsOptions.Builder to create a PostPartitionAllDocsOptions object that contains the parameter values for the postPartitionAllDocs method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

HTTP request body for postAllDocs and postPartitionAllDocs.

Examples:
AllDocsQuery

WithContext method only

The PostPartitionAllDocs options.

The postPartitionAllDocs options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products/_partition/small-appliances/_all_docs" -H "Content-Type: application/json" --data '{
      "include_docs": true
    }'
    
  • postPartitionAllDocsOptions := service.NewPostPartitionAllDocsOptions(
      "products",
      "small-appliances",
    )
    postPartitionAllDocsOptions.SetIncludeDocs(true)
    
    allDocsResult, response, err := service.PostPartitionAllDocs(postPartitionAllDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(allDocsResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.AllDocsResult;
    import com.ibm.cloud.cloudant.v1.model.PostPartitionAllDocsOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PostPartitionAllDocsOptions allDocsOptions =
        new PostPartitionAllDocsOptions.Builder()
            .db("products")
            .partitionKey("small-appliances")
            .includeDocs(true)
            .build();
    
    AllDocsResult response =
        service.postPartitionAllDocs(allDocsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postPartitionAllDocs({
      db: 'products',
      partitionKey: 'small-appliances',
      includeDocs: true
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_partition_all_docs(
      db='products',
      partition_key='small-appliances',
      include_docs=True
    ).get_result()
    
    print(response)
    

Response

Response type for PostPartitionAllDocs: AllDocsResult

Response type for PostPartitionAllDocsAsStream: io.ReadCloser

Response type for postPartitionAllDocs: AllDocsResult

Response type for postPartitionAllDocsAsStream: InputStream

Response type for postPartitionAllDocs: AllDocsResult

Response type for postPartitionAllDocsAsStream: NodeJS.ReadableStream

Response type for post_partition_all_docs: AllDocsResult

Response type for post_partition_all_docs_as_stream: BinaryIO

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a database partition search index (GET)

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

GET /{db}/_partition/{partition_key}/_design/{ddoc}/_search/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Query Parameters

  • Query parameter to specify a Lucene search query. Alias of q.

  • Query parameter to specify a bookmark that was received from a previous request. This parameter enables paging through the results. If there are no more results after the bookmark, you get a response containing no further results and the same bookmark, confirming the end of the result list.

  • Query parameter to specify which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Query parameter to specify a string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Query parameter to specify a string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • Query parameter to specify the number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • Query parameter to specify the number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify a JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or -fieldname<type> for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression ^-?[^<>]+(<(?:string|number)>)?$

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances/_design/appliances/_search/findByPrice?query=price:[14%20TO%2020]"
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

Response

Schema for the result of a query search operation.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a database partition search index (GET)

Retrieves the HTTP headers for a database partition search index (GET)."

HEAD /{db}/_partition/{partition_key}/_design/{ddoc}/_search/{index}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a database partition search index

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

POST /{db}/_partition/{partition_key}/_design/{ddoc}/_search/{index}
(cloudant *CloudantV1) PostPartitionSearch(postPartitionSearchOptions *PostPartitionSearchOptions) (result *SearchResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionSearchWithContext(ctx context.Context, postPartitionSearchOptions *PostPartitionSearchOptions) (result *SearchResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionSearchAsStream(postPartitionSearchOptions *PostPartitionSearchOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<SearchResult> postPartitionSearch(PostPartitionSearchOptions postPartitionSearchOptions)
ServiceCall<InputStream> postPartitionSearchAsStream(PostPartitionSearchOptions postPartitionSearchOptions)
postPartitionSearch(params)
postPartitionSearchAsStream(params)
post_partition_search(
        self,
        db: str,
        partition_key: str,
        ddoc: str,
        index: str,
        query: str,
        *,
        bookmark: Optional[str] = None,
        highlight_fields: Optional[List[str]] = None,
        highlight_number: Optional[int] = None,
        highlight_post_tag: Optional[str] = None,
        highlight_pre_tag: Optional[str] = None,
        highlight_size: Optional[int] = None,
        include_docs: Optional[bool] = None,
        include_fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        sort: Optional[List[str]] = None,
        stale: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_partition_search_as_stream(
        self,
        db: str,
        partition_key: str,
        ddoc: str,
        index: str,
        query: str,
        *,
        bookmark: Optional[str] = None,
        highlight_fields: Optional[List[str]] = None,
        highlight_number: Optional[int] = None,
        highlight_post_tag: Optional[str] = None,
        highlight_pre_tag: Optional[str] = None,
        highlight_size: Optional[int] = None,
        include_docs: Optional[bool] = None,
        include_fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        sort: Optional[List[str]] = None,
        stale: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Instantiate the PostPartitionSearchOptions struct and set the fields to provide parameter values for the PostPartitionSearch method.

Use the PostPartitionSearchOptions.Builder to create a PostPartitionSearchOptions object that contains the parameter values for the postPartitionSearch method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the index name.

HTTP request body for postPartitionSearch.

Examples:
Search

WithContext method only

The PostPartitionSearch options.

The postPartitionSearch options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index name.

  • The Lucene query to execute.

  • Opaque bookmark token used when paginating results.

  • Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • A string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • A string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Include the full content of the documents in the return.

    Default: false

  • A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Limit the number of the returned documents to the specified number.

    Possible values: 0 ≤ value ≤ 200

  • Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or "-fieldname<type>" for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression /^-?[^<>]+(<(?:string|number)>)?$/

  • Do not wait for the index to finish building to return results.

    Allowable values: [ok]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the index name.

  • The Lucene query to execute.

  • Opaque bookmark token used when paginating results.

  • Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.

  • Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.

    Possible values: value ≥ 1

    Default: 1

  • A string that is inserted after the highlighted word in the highlights output.

    Default: </em>

  • A string that is inserted before the highlighted word in the highlights output.

    Default: <em>

  • Number of characters in each fragment for highlights.

    Possible values: value ≥ 1

    Default: 100

  • Include the full content of the documents in the return.

    Default: false

  • A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.

  • Limit the number of the returned documents to the specified number.

    Possible values: 0 ≤ value ≤ 200

  • Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form "fieldname<type>" or "-fieldname<type>" for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are "foo", "-foo", "bar<string>", "-foo<number>" and ["-foo<number>", "bar<string>"]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.

    Possible values: Value must match regular expression /^-?[^<>]+(<(?:string|number)>)?$/

  • Do not wait for the index to finish building to return results.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products/_partition/small-appliances/_design/appliances/_search/findByPrice" -H "Content-Type: application/json" --data '{
      "query": "price:[14 TO 20]"
    }'
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • postPartitionSearchOptions := service.NewPostPartitionSearchOptions(
      "products",
      "small-appliances",
      "appliances",
      "findByPrice",
      "price:[14 TO 20]",
    )
    
    searchResult, response, err := service.PostPartitionSearch(postPartitionSearchOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(searchResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostPartitionSearchOptions;
    import com.ibm.cloud.cloudant.v1.model.SearchResult;
    
    Cloudant service = Cloudant.newInstance();
    
    PostPartitionSearchOptions searchOptions =
        new PostPartitionSearchOptions.Builder()
            .db("products")
            .partitionKey("small-appliances")
            .ddoc("appliances")
            .index("findByPrice")
            .query("price:[14 TO 20]")
            .build();
    
    SearchResult response =
        service.postPartitionSearch(searchOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postPartitionSearch({
      db: 'products',
      partitionKey: 'small-appliances',
      ddoc: 'appliances',
      index: 'findByPrice',
      query: 'price:[14 TO 20]'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_partition_search(
      db='products',
      partition_key='small-appliances',
      ddoc='appliances',
      index='findByPrice',
      query='price:[14 TO 20]'
    ).get_result()
    
    print(response)
    

    This example requires the findByPrice Cloudant Search partitioned index to exist. To create the design document with this index, see Create or modify a design document.

Response

Response type for PostPartitionSearch: SearchResult

Response type for PostPartitionSearchAsStream: io.ReadCloser

Response type for postPartitionSearch: SearchResult

Response type for postPartitionSearchAsStream: InputStream

Response type for postPartitionSearch: SearchResult

Response type for postPartitionSearchAsStream: NodeJS.ReadableStream

Response type for post_partition_search: SearchResult

Response type for post_partition_search_as_stream: BinaryIO

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Schema for the result of a query search operation.

Status Code

  • HTTP response for search operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example SearchResult response.

    {
      "bookmark": "g2wAAAEPeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGk5v9iztMQCGGRGZU3Wa4dSc5AMmkepgBlxdXgQ1gINr6PBaQhgYgBTRjP9iQDwxgkMhEtCsghhyAGAJxybeak2BDGLMAi8FWFQ",
      "rows": [
        {
          "fields": {},
          "id": "exampleid",
          "order": [
            "0.8410536050796509",
            "1"
          ]
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a database partition MapReduce view function (GET)

This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response.

GET /{db}/_partition/{partition_key}/_design/{ddoc}/_view/{view}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to group reduced results by key. Valid only if a reduce function is defined in the view. If the view emits keys in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Query parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify whether to sort the returned rows. Setting this to false offers a performance boost. The total_rows and offset fields are not available when this is set to false.

    Default: true

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_partition/small-appliances/_design/appliances/_view/byApplianceProdId?include_docs=true&limit=10"
    

    This example requires the byApplianceProdId partitioned view to exist. To create the view, see Create or modify a design document.

Response

Schema for the result of a query view operation.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a database partition MapReduce view function (GET)

Retrieves the HTTP headers for a database partition MapReduce view function (GET).

HEAD /{db}/_partition/{partition_key}/_design/{ddoc}/_view/{view}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a database partition MapReduce view function

Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

POST /{db}/_partition/{partition_key}/_design/{ddoc}/_view/{view}
(cloudant *CloudantV1) PostPartitionView(postPartitionViewOptions *PostPartitionViewOptions) (result *ViewResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionViewWithContext(ctx context.Context, postPartitionViewOptions *PostPartitionViewOptions) (result *ViewResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionViewAsStream(postPartitionViewOptions *PostPartitionViewOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<ViewResult> postPartitionView(PostPartitionViewOptions postPartitionViewOptions)
ServiceCall<InputStream> postPartitionViewAsStream(PostPartitionViewOptions postPartitionViewOptions)
postPartitionView(params)
postPartitionViewAsStream(params)
post_partition_view(
        self,
        db: str,
        partition_key: str,
        ddoc: str,
        view: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[object] = None,
        end_key_doc_id: Optional[str] = None,
        group: Optional[bool] = None,
        group_level: Optional[int] = None,
        key: Optional[object] = None,
        keys: Optional[List[object]] = None,
        reduce: Optional[bool] = None,
        start_key: Optional[object] = None,
        start_key_doc_id: Optional[str] = None,
        update: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_partition_view_as_stream(
        self,
        db: str,
        partition_key: str,
        ddoc: str,
        view: str,
        *,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        include_docs: Optional[bool] = None,
        inclusive_end: Optional[bool] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        update_seq: Optional[bool] = None,
        end_key: Optional[object] = None,
        end_key_doc_id: Optional[str] = None,
        group: Optional[bool] = None,
        group_level: Optional[int] = None,
        key: Optional[object] = None,
        keys: Optional[List[object]] = None,
        reduce: Optional[bool] = None,
        start_key: Optional[object] = None,
        start_key_doc_id: Optional[str] = None,
        update: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 0.01 read requests per row read from the index (rounded up) and one further read for each document included in the response.

Request

Instantiate the PostPartitionViewOptions struct and set the fields to provide parameter values for the PostPartitionView method.

Use the PostPartitionViewOptions.Builder to create a PostPartitionViewOptions object that contains the parameter values for the postPartitionView method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postPartitionView.

Examples:
ViewQuery

WithContext method only

The PostPartitionView options.

The postPartitionView options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression /^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Schema for any JSON type.

  • Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.

  • Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the map reduce view function name.

    Possible values: Value must match regular expression /^[a-z][a-z0-9_$()+\/-]*$/

  • Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.

    Default: false

  • Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.

    Possible values: 1 ≤ value ≤ 4294967295

  • Schema for any JSON type.

  • Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.

  • Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.

    Default: true

  • Schema for any JSON type.

  • Schema for a document ID.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • Parameter to specify whether or not the view in question should be updated prior to responding to the user.

    • true - Return results after the view is updated.
    • false - Return results without updating the view.
    • lazy - Return the view results without waiting for an update, but update them immediately after the request.

    Allowable values: [true,false,lazy]

    Default: true

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products/_partition/small-appliances/_design/appliances/_view/byApplianceProdId" -H "Content-Type: application/json" --data '{
      "include_docs": true,
      "limit": 10
    }'
    

    This example requires the byApplianceProdId partitioned view to exist. To create the view, see Create or modify a design document.

  • postPartitionViewOptions := service.NewPostPartitionViewOptions(
      "products",
      "small-appliances",
      "appliances",
      "byApplianceProdId",
    )
    postPartitionViewOptions.SetIncludeDocs(true)
    postPartitionViewOptions.SetLimit(10)
    
    viewResult, response, err := service.PostPartitionView(postPartitionViewOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(viewResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the byApplianceProdId partitioned view to exist. To create the view, see Create or modify a design document.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.PostPartitionViewOptions;
    import com.ibm.cloud.cloudant.v1.model.ViewResult;
    
    Cloudant service = Cloudant.newInstance();
    
    PostPartitionViewOptions viewOptions =
        new PostPartitionViewOptions.Builder()
            .db("products")
            .ddoc("appliances")
            .includeDocs(true)
            .limit(10)
            .partitionKey("small-appliances")
            .view("byApplianceProdId")
            .build();
    
    ViewResult response =
        service.postPartitionView(viewOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the byApplianceProdId partitioned view to exist. To create the design document with this view, see Create or modify a design document.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postPartitionView({
      db: 'products',
      ddoc: 'appliances',
      includeDocs: true,
      limit: 10,
      partitionKey: 'small-appliances',
      view: 'byApplianceProdId'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the byApplianceProdId partitioned view to exist. To create the design document with this view, see Create or modify a design document.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_partition_view(
      db='products',
      ddoc='appliances',
      limit=10,
      partition_key='small-appliances',
      view='byApplianceProdId'
    ).get_result()
    
    print(response)
    

    This example requires the byApplianceProdId partitioned view to exist. To create the design document with this view, see Create or modify a design document.

Response

Response type for PostPartitionView: ViewResult

Response type for PostPartitionViewAsStream: io.ReadCloser

Response type for postPartitionView: ViewResult

Response type for postPartitionViewAsStream: InputStream

Response type for postPartitionView: ViewResult

Response type for postPartitionViewAsStream: NodeJS.ReadableStream

Response type for post_partition_view: ViewResult

Response type for post_partition_view_as_stream: BinaryIO

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Schema for the result of a query view operation.

Status Code

  • HTTP response for view operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example ViewResult response.

    {
      "offset": 0,
      "rows": [
        {
          "id": "abc125",
          "key": "amelie.smith@aol.com",
          "value": [
            "Amelie Smith",
            true,
            "2020-04-24T10:42:59.000Z"
          ]
        },
        {
          "id": "abc123",
          "key": "bob.smith@aol.com",
          "value": [
            "Bob Smith",
            true,
            "2019-01-24T10:42:59.000Z"
          ]
        }
      ],
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve information about which partition index is used for a query

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

Shows which index is being used by the query. Parameters are the same as the /{db}/_partition/{partition_key}/_find endpoint.

POST /{db}/_partition/{partition_key}/_explain
(cloudant *CloudantV1) PostPartitionExplain(postPartitionExplainOptions *PostPartitionExplainOptions) (result *ExplainResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionExplainWithContext(ctx context.Context, postPartitionExplainOptions *PostPartitionExplainOptions) (result *ExplainResult, response *core.DetailedResponse, err error)
ServiceCall<ExplainResult> postPartitionExplain(PostPartitionExplainOptions postPartitionExplainOptions)
postPartitionExplain(params)
post_partition_explain(
        self,
        db: str,
        partition_key: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 1.01 read requests per row read from the index (rounded up). If no rows are read, the minimum cost is 1 read.

Request

Instantiate the PostPartitionExplainOptions struct and set the fields to provide parameter values for the PostPartitionExplain method.

Use the PostPartitionExplainOptions.Builder to create a PostPartitionExplainOptions object that contains the parameter values for the postPartitionExplain method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

HTTP request body for postPartitionFind.

Examples:
PartitionFindQuery

WithContext method only

The PostPartitionExplain options.

The postPartitionExplain options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

Response

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Schema for information about the index used for a find query.

Status Code

  • HTTP response for postExplain.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ExplainResult response.

    {
      "covering": false,
      "dbname": "users",
      "fields": [],
      "index": {
        "ddoc": "_design/id-index",
        "def": {
          "fields": [
            {
              "_id": "asc"
            }
          ]
        },
        "name": "d479bdddf50865e520a0193704c8b93a3bd48f77",
        "type": "json"
      },
      "limit": 10,
      "mrargs": {
        "conflicts": "undefined",
        "direction": "fwd",
        "end_key": [
          "<MAX>"
        ],
        "include_docs": true,
        "partition": null,
        "reduce": false,
        "stable": false,
        "start_key": [],
        "update": true,
        "view_type": "map"
      },
      "opts": {
        "bookmark": "nil",
        "conflicts": false,
        "execution_stats": true,
        "fields": [],
        "limit": 10,
        "partition": "",
        "r": 1,
        "skip": 0,
        "sort": {},
        "stable": false,
        "stale": false,
        "update": false,
        "use_index": []
      },
      "partitioned": true,
      "selector": {
        "type": {
          "$eq": "user"
        }
      },
      "skip": 0
    }
  • Example ExplainResult response.

    {
      "covering": false,
      "dbname": "users",
      "fields": [],
      "index": {
        "ddoc": "_design/id-index",
        "def": {
          "fields": [
            {
              "_id": "asc"
            }
          ]
        },
        "name": "d479bdddf50865e520a0193704c8b93a3bd48f77",
        "type": "json"
      },
      "limit": 10,
      "mrargs": {
        "conflicts": "undefined",
        "direction": "fwd",
        "end_key": [
          "<MAX>"
        ],
        "include_docs": true,
        "partition": null,
        "reduce": false,
        "stable": false,
        "start_key": [],
        "update": true,
        "view_type": "map"
      },
      "opts": {
        "bookmark": "nil",
        "conflicts": false,
        "execution_stats": true,
        "fields": [],
        "limit": 10,
        "partition": "",
        "r": 1,
        "skip": 0,
        "sort": {},
        "stable": false,
        "stale": false,
        "update": false,
        "use_index": []
      },
      "partitioned": true,
      "selector": {
        "type": {
          "$eq": "user"
        }
      },
      "skip": 0
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a database partition index by using selector syntax

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

POST /{db}/_partition/{partition_key}/_find
(cloudant *CloudantV1) PostPartitionFind(postPartitionFindOptions *PostPartitionFindOptions) (result *FindResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionFindWithContext(ctx context.Context, postPartitionFindOptions *PostPartitionFindOptions) (result *FindResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostPartitionFindAsStream(postPartitionFindOptions *PostPartitionFindOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<FindResult> postPartitionFind(PostPartitionFindOptions postPartitionFindOptions)
ServiceCall<InputStream> postPartitionFindAsStream(PostPartitionFindOptions postPartitionFindOptions)
postPartitionFind(params)
postPartitionFindAsStream(params)
post_partition_find(
        self,
        db: str,
        partition_key: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse
post_partition_find_as_stream(
        self,
        db: str,
        partition_key: str,
        selector: dict,
        *,
        bookmark: Optional[str] = None,
        conflicts: Optional[bool] = None,
        execution_stats: Optional[bool] = None,
        fields: Optional[List[str]] = None,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        sort: Optional[List[dict]] = None,
        stable: Optional[bool] = None,
        update: Optional[str] = None,
        use_index: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes 1.01 read requests per row read from the index (rounded up). If no rows are read, the minimum cost is 1 read.

Request

Instantiate the PostPartitionFindOptions struct and set the fields to provide parameter values for the PostPartitionFind method.

Use the PostPartitionFindOptions.Builder to create a PostPartitionFindOptions object that contains the parameter values for the postPartitionFind method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the database partition key.

HTTP request body for postPartitionFind.

Examples:
PartitionFindQuery

WithContext method only

The PostPartitionFind options.

The postPartitionFind options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the database partition key.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Opaque bookmark token used when paginating results.

  • A boolean value that indicates whether or not to include information about existing conflicts in the document.

  • Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • Maximum number of results returned. The type: text indexes are limited to 200 results when queried.

    Possible values: value ≥ 0

    Default: 25

  • Skip the first 'n' results, where 'n' is the value that is specified.

    Possible values: value ≥ 0

  • The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields.

    For example in JSON: [{"fieldName1": "desc"}, {"fieldName2.subFieldName1": "desc"}]

    When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.

    Allowable values: [asc,desc]

  • Whether or not the view results should be returned from a "stable" set of shards.

  • Whether to update the index prior to returning the result.

    Allowable values: [false,true,lazy]

    Default: true

  • Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/products/_partition/small-appliances/_find" -H "Content-Type: application/json" --data '{
      "fields": [
        "productid",
        "name",
        "description"
      ],
      "selector": {
        "type": {
          "$eq": "product"
        }
      }
    }'
    
  • selector := map[string]interface{}{
      "type": map[string]string{
        "$eq": "product",
      },
    }
    
    postPartitionFindOptions := service.NewPostPartitionFindOptions(
      "products",
      "small-appliances",
      selector,
    )
    postPartitionFindOptions.SetFields([]string{
      "productid", "name", "description",
    })
    
    findResult, response, err := service.PostPartitionFind(postPartitionFindOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(findResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.FindResult;
    import com.ibm.cloud.cloudant.v1.model.PostPartitionFindOptions;
    
    import java.util.Arrays;
    import java.util.HashMap;
    import java.util.Map;
    
    Cloudant service = Cloudant.newInstance();
    
    Map<String, String> typeEqualsProduct = new HashMap<>();
    typeEqualsProduct.put("$eq", "product");
    
    Map<String, Object> selector = new HashMap<>();
    selector.put("type", typeEqualsProduct);
    
    PostPartitionFindOptions findOptions =
        new PostPartitionFindOptions.Builder()
            .db("products")
            .partitionKey("small-appliances")
            .fields(Arrays.asList("productid", "name", "description"))
            .selector(selector)
            .build();
    
    FindResult response =
        service.postPartitionFind(findOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const selector: CloudantV1.Selector = {
      type: {'$eq': 'product'}
    }
    service.postPartitionFind({
      db: 'products',
      partitionKey: 'small-appliances',
      fields: ['productid', 'name', 'description'],
      selector: selector
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_partition_find(
      db='products',
      partition_key='small-appliances',
      fields=['productid', 'name', 'description'],
      selector={'type': {'$eq': 'product'}}
    ).get_result()
    
    print(response)
    

Response

Response type for PostPartitionFind: FindResult

Response type for PostPartitionFindAsStream: io.ReadCloser

Response type for postPartitionFind: FindResult

Response type for postPartitionFindAsStream: InputStream

Response type for postPartitionFind: FindResult

Response type for postPartitionFindAsStream: NodeJS.ReadableStream

Response type for post_partition_find: FindResult

Response type for post_partition_find_as_stream: BinaryIO

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Schema for the result of a query find operation.

Status Code

  • HTTP response for postFind and postPartitionFind.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example FindResult response.

    {
      "bookmark": "g1AAAABCeJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYqzJSYlGxoZg2Q5YLI5QHFGJMmsLABByhEQ",
      "docs": [
        {
          "_id": "exampleid",
          "description": "A professional, high powered innovative kitchen tool",
          "email": "amelie.smith@aol.com",
          "name": "1100",
          "productid": "1000043",
          "type": "user"
        },
        {
          "_id": "exampleid2",
          "description": "New and improved kitchen blender",
          "email": "bob.smith@aol.com",
          "name": "Pro System 3000",
          "productid": "1000044",
          "type": "user"
        }
      ],
      "execution_stats": {
        "execution_time_ms": 4.37,
        "results_returned": 2,
        "total_docs_examined": 4,
        "total_keys_examined": 0,
        "total_quorum_docs_examined": 0
      }
    }
  • Example FindResult response.

    {
      "bookmark": "g1AAAABCeJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYqzJSYlGxoZg2Q5YLI5QHFGJMmsLABByhEQ",
      "docs": [
        {
          "_id": "exampleid",
          "description": "A professional, high powered innovative kitchen tool",
          "email": "amelie.smith@aol.com",
          "name": "1100",
          "productid": "1000043",
          "type": "user"
        },
        {
          "_id": "exampleid2",
          "description": "New and improved kitchen blender",
          "email": "bob.smith@aol.com",
          "name": "Pro System 3000",
          "productid": "1000044",
          "type": "user"
        }
      ],
      "execution_stats": {
        "execution_time_ms": 4.37,
        "results_returned": 2,
        "total_docs_examined": 4,
        "total_keys_examined": 0,
        "total_quorum_docs_examined": 0
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve change events for all databases

This endpoint is not available in IBM Cloudant.

Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order and might repeat changes. Polling modes for this method work like polling modes for the changes feed.

This endpoint is not available in IBM Cloudant.

Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order and might repeat changes. Polling modes for this method work like polling modes for the changes feed.

This endpoint is not available in IBM Cloudant.

Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order and might repeat changes. Polling modes for this method work like polling modes for the changes feed.

This endpoint is not available in IBM Cloudant.

Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order and might repeat changes. Polling modes for this method work like polling modes for the changes feed.

This endpoint is not available in IBM Cloudant.

Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order and might repeat changes. Polling modes for this method work like polling modes for the changes feed.

GET /_db_updates
(cloudant *CloudantV1) GetDbUpdates(getDbUpdatesOptions *GetDbUpdatesOptions) (result *DbUpdates, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDbUpdatesWithContext(ctx context.Context, getDbUpdatesOptions *GetDbUpdatesOptions) (result *DbUpdates, response *core.DetailedResponse, err error)
ServiceCall<DbUpdates> getDbUpdates(GetDbUpdatesOptions getDbUpdatesOptions)
getDbUpdates(params)
get_db_updates(
        self,
        *,
        descending: Optional[bool] = None,
        feed: Optional[str] = None,
        heartbeat: Optional[int] = None,
        limit: Optional[int] = None,
        timeout: Optional[int] = None,
        since: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-db-updates.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-db-updates.read

Request

Instantiate the GetDbUpdatesOptions struct and set the fields to provide parameter values for the GetDbUpdates method.

Use the GetDbUpdatesOptions.Builder to create a GetDbUpdatesOptions object that contains the parameter values for the getDbUpdates method.

Query Parameters

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

WithContext method only

The GetDbUpdates options.

The getDbUpdates options.

parameters

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

parameters

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_db_updates?feed=normal&heartbeat=10000&since=now"
    
  • getDbUpdatesOptions := service.NewGetDbUpdatesOptions()
    getDbUpdatesOptions.SetFeed("normal")
    getDbUpdatesOptions.SetHeartbeat(10000)
    getDbUpdatesOptions.SetSince("now")
    
    dbUpdates, response, err := service.GetDbUpdates(getDbUpdatesOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(dbUpdates, "", "  ")
    fmt.Println(string(b))
    

    This request requires server_admin access.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DbUpdates;
    import com.ibm.cloud.cloudant.v1.model.GetDbUpdatesOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    GetDbUpdatesOptions dbUpdatesOptions = new GetDbUpdatesOptions.Builder()
        .feed("normal")
        .heartbeat(10000)
        .since("now")
        .build();
    
    DbUpdates response =
        service.getDbUpdates(dbUpdatesOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This request requires server_admin access.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getDbUpdates({
      feed: 'normal',
      heartbeat: 10000,
      since: 'now'
    }).then(response => {
      console.log(response.result);
    });
    

    This request requires server_admin access.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_db_updates(
      feed='normal',
      heartbeat=10000,
      since='now'
    ).get_result()
    
    print(response)
    

    This request requires server_admin access.

Response

Schema for database updates.

Schema for database updates.

Schema for database updates.

Schema for database updates.

Schema for database updates.

Status Code

  • HTTP response for /_db_updates style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DbUpdates response.

    {
      "last_seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0",
      "results": [
        {
          "dbname": "events",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0",
          "type": "created"
        }
      ]
    }
  • Example DbUpdates response.

    {
      "last_seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0",
      "results": [
        {
          "dbname": "events",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0",
          "type": "created"
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for change events for all databases

Retrieves the HTTP headers for change events of all databases.

HEAD /_db_updates

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-db-updates.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-db-updates.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_db_updates style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query the database document changes feed (GET)

Returns a sorted list of changes made to documents in the database, in time order of application. Only the most recent change for a specific document is included in the list. For example, if you add fields to a document and then delete them, an API client that checks for changes might not know about the intermediate state of added documents. These checks listen for updates to the database for post processing or synchronization, and for practical purposes, a continuously connected _changes feed is a reasonable approach for generating a real-time log for most applications.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

GET /{db}/_changes

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Custom Headers

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify a JSON array list of document IDs to restrict the changes feed to. Used with the _doc_ids filter. Since length of URL is limited, it is better to use POST /{db}/_changes instead.

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the ID of the last events received by the server on a previous connection. Alias of Last-Event-ID header.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/orders/_changes?limit=1"
    

Response

Schema for normal changes feed result.

Status Code

  • HTTP response for /{db}/_changes style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ChangesResult response.

    {
      "last_seq": "7-g1AAAAPveJy1kk9OAjEYxSuYGBO3nsCdC9LOP5yVXkGhB-jXdoKTsSQG1p7CKyj0Ep6CS3AGob5hwYSNMJOwek3T971fXr-KMXYz6Rt2Z0hP3-2ToWygq-ncKDfjXOzPA2dnFR73FKNbKcelYoe2-H9bbZJ07_2ynPTVxRvurjTPhU6i06YcpkVH0hDk6TGEbWtOmAKBddRwUpw-iKE4ByeCxlR6v2jNCdOSPkLY1JxsxykyLlKuDLueO2OLV2dNq6-tx23dJXuR8rMtD2wj2CDfqL5m6u2Ycp1HQ5N26e4ILaIWiIL8hvDTgXcDG-RZylXDm8V5IbLkPLwodgX58n7dgRfFriHYz9DsZpqQtQWdNqn8A1TdTOE",
      "pending": 3,
      "results": [
        {
          "changes": [
            {
              "rev": "7-7a5191bfeb2f6eed6b3b6fa83f4810f5"
            }
          ],
          "deleted": true,
          "id": "0007741142412418284",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0"
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for the database document changes feed (GET)

Retrieves the HTTP headers for the database document changes feed (GET).

HEAD /{db}/_changes

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Custom Headers

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_changes style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query the database document changes feed

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

Note

Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.

POST /{db}/_changes
(cloudant *CloudantV1) PostChanges(postChangesOptions *PostChangesOptions) (result *ChangesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostChangesWithContext(ctx context.Context, postChangesOptions *PostChangesOptions) (result *ChangesResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostChangesAsStream(postChangesOptions *PostChangesOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<ChangesResult> postChanges(PostChangesOptions postChangesOptions)
ServiceCall<InputStream> postChangesAsStream(PostChangesOptions postChangesOptions)
postChanges(params)
postChangesAsStream(params)
post_changes(
        self,
        db: str,
        *,
        doc_ids: Optional[List[str]] = None,
        fields: Optional[List[str]] = None,
        selector: Optional[dict] = None,
        last_event_id: Optional[str] = None,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        feed: Optional[str] = None,
        filter: Optional[str] = None,
        heartbeat: Optional[int] = None,
        include_docs: Optional[bool] = None,
        limit: Optional[int] = None,
        seq_interval: Optional[int] = None,
        since: Optional[str] = None,
        style: Optional[str] = None,
        timeout: Optional[int] = None,
        view: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse
post_changes_as_stream(
        self,
        db: str,
        *,
        doc_ids: Optional[List[str]] = None,
        fields: Optional[List[str]] = None,
        selector: Optional[dict] = None,
        last_event_id: Optional[str] = None,
        att_encoding_info: Optional[bool] = None,
        attachments: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        descending: Optional[bool] = None,
        feed: Optional[str] = None,
        filter: Optional[str] = None,
        heartbeat: Optional[int] = None,
        include_docs: Optional[bool] = None,
        limit: Optional[int] = None,
        seq_interval: Optional[int] = None,
        since: Optional[str] = None,
        style: Optional[str] = None,
        timeout: Optional[int] = None,
        view: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Instantiate the PostChangesOptions struct and set the fields to provide parameter values for the PostChanges method.

Use the PostChangesOptions.Builder to create a PostChangesOptions object that contains the parameter values for the postChanges method.

Custom Headers

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the ID of the last events received by the server on a previous connection. Alias of Last-Event-ID header.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

HTTP request body for postChanges.

Examples:
ChangesFilterDocIds
ChangesFilterSelector

WithContext method only

The PostChanges options.

The postChanges options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for a list of document IDs.

    Possible values: Value must match regular expression /^([^_]|_(design|local)\/).+/

  • JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

  • JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

    The selector object must:

    • Be structured as valid JSON.
    • Contain a valid query expression.

    Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

    Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

    Operators are identified by the use of a dollar sign $ prefix in the name field.

    There are two core types of operators in the selector syntax:

    • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
    • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
    • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

    For further reference see selector syntax.

  • Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify the changes feed type.

    Allowable values: [continuous,eventsource,longpoll,normal]

    Default: normal

  • Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

    Additionally, some keywords are reserved for built-in filters:

    • _design - Returns only changes to design documents.
    • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
    • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
    • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
  • Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

    Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

    • Use the timeout parameter with a value that is compatible with your network environment.
    • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
    • Use TCP keepalive.

    Possible values: 0 ≤ value ≤ 60000

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

    Possible values: value ≥ 1

  • Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

    Default: 0

  • Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

    Default: main_only

  • Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

    Possible values: 0 ≤ value ≤ 60000

    Default: 60000

  • Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/orders/_changes" -H "Content-Type: application/json" --data '{
     "doc_ids": [
     "small-appliances:1000042"
     ]
    }'
    
  • postChangesOptions := service.NewPostChangesOptions(
      "orders",
    )
    
    changesResult, response, err := service.PostChanges(postChangesOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(changesResult, "", "  ")
    fmt.Println(string(b))
    
  • postChangesOptions := service.NewPostChangesOptions(
      "orders",
    )
    
    changesResult, response, err := service.PostChangesAsStream(postChangesOptions)
    if err != nil {
      panic(err)
    }
    
    if changesResult != nil {
      defer changesResult.Close()
      outFile, err := os.Create("result.json")
      if err != nil {
        panic(err)
      }
      defer outFile.Close()
      if _, err = io.Copy(outFile, changesResult); err != nil {
        panic(err)
      }
    }
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ChangesResult;
    import com.ibm.cloud.cloudant.v1.model.PostChangesOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PostChangesOptions changesOptions = new PostChangesOptions.Builder()
        .db("orders")
        .build();
    
    ChangesResult response =
        service.postChanges(changesOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ChangesResult;
    import com.ibm.cloud.cloudant.v1.model.PostChangesOptions;
    
    import java.io.InputStream;
    import java.io.File;
    import java.nio.file.StandardCopyOption;
    
    Cloudant service = Cloudant.newInstance();
    
    PostChangesOptions changesOptions = new PostChangesOptions.Builder()
        .db("orders")
        .build();
    
    File file = new File("result.json");
    
    try (InputStream response =
            service.postChangesAsStream(changesOptions).execute()
                .getResult()) {
        java.nio.file.Files.copy(
            response,
            file.toPath(),
            StandardCopyOption.REPLACE_EXISTING);
    }
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postChanges({
      db: 'orders'
    }).then(response => {
      console.log(response.result);
    });
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postChangesAsStream({
      db: 'orders'
    }).then(response => {
      let stream = fs.createWriteStream("result.json");
      response.result.pipe(stream);
      response.result.on('end', () => stream.end());
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    response = service.post_changes(
      db='orders'
    ).get_result()
    
    print(response)
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    result = service.post_changes_as_stream(
      db='orders'
    ).get_result()
    
    with open('result.json', 'wb') as f:
      for chunk in result.iter_content():
        f.write(chunk)
    

Response

Response type for PostChanges: ChangesResult

Response type for PostChangesAsStream: io.ReadCloser

Response type for postChanges: ChangesResult

Response type for postChangesAsStream: InputStream

Response type for postChanges: ChangesResult

Response type for postChangesAsStream: NodeJS.ReadableStream

Response type for post_changes: ChangesResult

Response type for post_changes_as_stream: BinaryIO

Schema for normal changes feed result.

Schema for normal changes feed result.

Schema for normal changes feed result.

Schema for normal changes feed result.

Schema for normal changes feed result.

Status Code

  • HTTP response for /{db}/_changes style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ChangesResult response.

    {
      "last_seq": "7-g1AAAAPveJy1kk9OAjEYxSuYGBO3nsCdC9LOP5yVXkGhB-jXdoKTsSQG1p7CKyj0Ep6CS3AGob5hwYSNMJOwek3T971fXr-KMXYz6Rt2Z0hP3-2ToWygq-ncKDfjXOzPA2dnFR73FKNbKcelYoe2-H9bbZJ07_2ynPTVxRvurjTPhU6i06YcpkVH0hDk6TGEbWtOmAKBddRwUpw-iKE4ByeCxlR6v2jNCdOSPkLY1JxsxykyLlKuDLueO2OLV2dNq6-tx23dJXuR8rMtD2wj2CDfqL5m6u2Ycp1HQ5N26e4ILaIWiIL8hvDTgXcDG-RZylXDm8V5IbLkPLwodgX58n7dgRfFriHYz9DsZpqQtQWdNqn8A1TdTOE",
      "pending": 3,
      "results": [
        {
          "changes": [
            {
              "rev": "7-7a5191bfeb2f6eed6b3b6fa83f4810f5"
            }
          ],
          "deleted": true,
          "id": "0007741142412418284",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0"
        }
      ]
    }
  • Example ChangesResult response.

    {
      "last_seq": "7-g1AAAAPveJy1kk9OAjEYxSuYGBO3nsCdC9LOP5yVXkGhB-jXdoKTsSQG1p7CKyj0Ep6CS3AGob5hwYSNMJOwek3T971fXr-KMXYz6Rt2Z0hP3-2ToWygq-ncKDfjXOzPA2dnFR73FKNbKcelYoe2-H9bbZJ07_2ynPTVxRvurjTPhU6i06YcpkVH0hDk6TGEbWtOmAKBddRwUpw-iKE4ByeCxlR6v2jNCdOSPkLY1JxsxykyLlKuDLueO2OLV2dNq6-tx23dJXuR8rMtD2wj2CDfqL5m6u2Ycp1HQ5N26e4ILaIWiIL8hvDTgXcDG-RZylXDm8V5IbLkPLwodgX58n7dgRfFriHYz9DsZpqQtQWdNqn8A1TdTOE",
      "pending": 3,
      "results": [
        {
          "changes": [
            {
              "rev": "7-7a5191bfeb2f6eed6b3b6fa83f4810f5"
            }
          ],
          "deleted": true,
          "id": "0007741142412418284",
          "seq": "1-g1AAAAMFeJydkcENgjAUhquYePHqBN48EEBj4klXUOgAbSExDUJi8OwUrqDQJZyCJZhBqD8XE0Iiwulvmvf1e68vJITMToZPFj4X8SXY-3xjijC--ixKLMv-ns0oSEIUjxnhc0o9yUgTW_3GaojypVKZPBlsdMbdVFhbW6yd_15p2pwOG0SK77SuevcJSHP06rbILicgj0ul0t5OQBm_aV22yI5l1FAVTciR0ntfKzAXGOKJz-prBpYCQ7y1fg1wl8AQB0rzAW4MnCMeShUD3Bi4QGDTGrT8AMkPBk0"
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Create a transient replication

Requests, configures, or stops a replicate operation. Note: Use the _replicator database to persist the replication configuration. That usage is preferred over this /_replicate endpoint, which is a transient operation.

POST /_replicate

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication.write

Rate limit

This operation consumes one write request.

Request

HTTP request body for replication operations.

Examples:
ReplicationDocument
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/_replicate" -H "Content-Type: application/json" --data '{
      "_id": "repldoc-example",
      "create_target": true,
      "source": {
        "url": "'"$SOURCE_SERVICE_URL/animaldb"'"
      },
      "target": {
        "auth": {
          "iam": {
            "api_key": "'"$API_KEY"'"
          }
        },
        "url": "'"$TARGET_SERVICE_URL/animaldb-target"'"
      }
    }'
    

Response

Schema for a replication result.

Status Code

  • HTTP response for postReplicate.

  • HTTP response for postReplicate.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ReplicationResult response.

    {
      "history": [
        {
          "doc_write_failures": 0,
          "docs_read": 10,
          "docs_written": 10,
          "end_last_seq": "28-abcdefghijklmnopqrstuvwxyz",
          "end_time": "Sun, 11 Aug 2019 20:38:50 GMT",
          "missing_checked": 10,
          "missing_found": 10,
          "recorded_seq": "28-abcdefghijklmnopqrstuvwxyz",
          "session_id": "142a35854a08e205c47174d91b1f9628",
          "start_last_seq": "1-abcdefghijklmnopqrstuvwxyz",
          "start_time": "Sun, 11 Aug 2019 20:38:50 GMT"
        }
      ],
      "ok": true,
      "replication_id_version": 3,
      "session_id": "142a35854a08e205c47174d91b1f9628",
      "source_last_seq": "28-abcdefghijklmnopqrstuvwxyz"
    }
  • Example ReplicationInformation response.

    {
      "_local_id": "460b3a44135318afce548ec26b604e6f+continuous",
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Cancel a replication

Cancels a replication by deleting the document that describes it from the _replicator database.

Cancels a replication by deleting the document that describes it from the _replicator database.

Cancels a replication by deleting the document that describes it from the _replicator database.

Cancels a replication by deleting the document that describes it from the _replicator database.

Cancels a replication by deleting the document that describes it from the _replicator database.

DELETE /_replicator/{doc_id}
(cloudant *CloudantV1) DeleteReplicationDocument(deleteReplicationDocumentOptions *DeleteReplicationDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteReplicationDocumentWithContext(ctx context.Context, deleteReplicationDocumentOptions *DeleteReplicationDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> deleteReplicationDocument(DeleteReplicationDocumentOptions deleteReplicationDocumentOptions)
deleteReplicationDocument(params)
delete_replication_document(
        self,
        doc_id: str,
        *,
        if_match: Optional[str] = None,
        batch: Optional[str] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication.write

Rate limit

This operation consumes one write request.

Request

Instantiate the DeleteReplicationDocumentOptions struct and set the fields to provide parameter values for the DeleteReplicationDocument method.

Use the DeleteReplicationDocumentOptions.Builder to create a DeleteReplicationDocumentOptions object that contains the parameter values for the deleteReplicationDocument method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

WithContext method only

The DeleteReplicationDocument options.

The deleteReplicationDocument options.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/_replicator/repldoc-example?rev=<document-revision>"
    
  • deleteReplicationDocumentOptions := service.NewDeleteReplicationDocumentOptions(
      "repldoc-example",
    )
    deleteReplicationDocumentOptions.SetRev("3-a0ccbdc6fe95b4184f9031d086034d85")
    
    documentResult, response, err := service.DeleteReplicationDocument(deleteReplicationDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteReplicationDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteReplicationDocumentOptions replicationDocOptions =
        new DeleteReplicationDocumentOptions.Builder()
            .docId("repldoc-example")
            .rev("3-a0ccbdc6fe95b4184f9031d086034d85")
            .build();
    
    DocumentResult response =
        service.deleteReplicationDocument(replicationDocOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.deleteReplicationDocument({
      docId: 'repldoc-example',
      rev: '3-a0ccbdc6fe95b4184f9031d086034d85'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_replication_document(
    doc_id='repldoc-example',
    rev='3-a0ccbdc6fe95b4184f9031d086034d85'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve a replication document

Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.

Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.

Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.

Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.

Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.

GET /_replicator/{doc_id}
(cloudant *CloudantV1) GetReplicationDocument(getReplicationDocumentOptions *GetReplicationDocumentOptions) (result *ReplicationDocument, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetReplicationDocumentWithContext(ctx context.Context, getReplicationDocumentOptions *GetReplicationDocumentOptions) (result *ReplicationDocument, response *core.DetailedResponse, err error)
ServiceCall<ReplicationDocument> getReplicationDocument(GetReplicationDocumentOptions getReplicationDocumentOptions)
getReplicationDocument(params)
get_replication_document(
        self,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        conflicts: Optional[bool] = None,
        deleted_conflicts: Optional[bool] = None,
        latest: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        meta: Optional[bool] = None,
        rev: Optional[str] = None,
        revs: Optional[bool] = None,
        revs_info: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetReplicationDocumentOptions struct and set the fields to provide parameter values for the GetReplicationDocument method.

Use the GetReplicationDocumentOptions.Builder to create a GetReplicationDocumentOptions object that contains the parameter values for the getReplicationDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments only since specified revisions. Note this does not include the attachments for the specified revisions.

    Examples:
    View
  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify leaf revisions to retrieve. Additionally, it accepts a value of all to return all leaf revisions.

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

WithContext method only

The GetReplicationDocument options.

The getReplicationDocument options.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.

    Default: false

  • Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.

    Default: false

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to include a list of all known document revisions.

    Default: false

  • Query parameter to specify whether to includes detailed information for all known document revisions.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_replicator/repldoc-example"
    
  • getReplicationDocumentOptions := service.NewGetReplicationDocumentOptions(
      "repldoc-example",
    )
    
    replicationDocument, response, err := service.GetReplicationDocument(getReplicationDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(replicationDocument, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetReplicationDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.ReplicationDocument;
    
    Cloudant service = Cloudant.newInstance();
    
    GetReplicationDocumentOptions replicationDocOptions =
        new GetReplicationDocumentOptions.Builder()
            .docId("repldoc-example")
            .build();
    
    ReplicationDocument response =
        service.getReplicationDocument(replicationDocOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getReplicationDocument({
      docId: 'repldoc-example'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_replication_document(
      doc_id='repldoc-example'
    ).get_result()
    
    print(response)
    

Response

Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

Status Code

  • HTTP response for ReplicationDocument.

  • Document hasn't been modified since the specified revision.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ReplicationDocument request.

    {
      "cancel": false,
      "checkpoint_interval": 4500,
      "connection_timeout": 15000,
      "continuous": true,
      "create_target": true,
      "create_target_params": {
        "q": 1
      },
      "doc_ids": [
        "badger",
        "lemur",
        "llama"
      ],
      "filter": "ddoc/my_filter",
      "http_connections": 10,
      "retries_per_request": 3,
      "selector": {
        "_id": {
          "$regex": "docid"
        }
      },
      "since_seq": "34-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdU",
      "socket_options": "[{keepalive, true}, {nodelay, false}]",
      "source": {
        "url": "https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb"
      },
      "target": {
        "auth": {
          "iam": {
            "api_key": "<iam_api_key>"
          }
        },
        "url": "https://my-target-instance.cloudantnosqldb.appdomain.cloud.example/animaldb-target"
      },
      "use_checkpoints": false,
      "user_ctx": {
        "name": "john",
        "roles": [
          "researcher"
        ]
      },
      "worker_batch_size": 400,
      "worker_processes": 3
    }
  • Example ReplicationDocument request.

    {
      "cancel": false,
      "checkpoint_interval": 4500,
      "connection_timeout": 15000,
      "continuous": true,
      "create_target": true,
      "create_target_params": {
        "q": 1
      },
      "doc_ids": [
        "badger",
        "lemur",
        "llama"
      ],
      "filter": "ddoc/my_filter",
      "http_connections": 10,
      "retries_per_request": 3,
      "selector": {
        "_id": {
          "$regex": "docid"
        }
      },
      "since_seq": "34-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdU",
      "socket_options": "[{keepalive, true}, {nodelay, false}]",
      "source": {
        "url": "https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb"
      },
      "target": {
        "auth": {
          "iam": {
            "api_key": "<iam_api_key>"
          }
        },
        "url": "https://my-target-instance.cloudantnosqldb.appdomain.cloud.example/animaldb-target"
      },
      "use_checkpoints": false,
      "user_ctx": {
        "name": "john",
        "roles": [
          "researcher"
        ]
      },
      "worker_batch_size": 400,
      "worker_processes": 3
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for a replication document

Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the _replicator database. The method supports the same query arguments as the GET /_replicator/{doc_id} method, but only headers like content length and the revision (ETag header) are returned.

Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the _replicator database. The method supports the same query arguments as the GET /_replicator/{doc_id} method, but only headers like content length and the revision (ETag header) are returned.

Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the _replicator database. The method supports the same query arguments as the GET /_replicator/{doc_id} method, but only headers like content length and the revision (ETag header) are returned.

Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the _replicator database. The method supports the same query arguments as the GET /_replicator/{doc_id} method, but only headers like content length and the revision (ETag header) are returned.

Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the _replicator database. The method supports the same query arguments as the GET /_replicator/{doc_id} method, but only headers like content length and the revision (ETag header) are returned.

HEAD /_replicator/{doc_id}
(cloudant *CloudantV1) HeadReplicationDocument(headReplicationDocumentOptions *HeadReplicationDocumentOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadReplicationDocumentWithContext(ctx context.Context, headReplicationDocumentOptions *HeadReplicationDocumentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headReplicationDocument(HeadReplicationDocumentOptions headReplicationDocumentOptions)
headReplicationDocument(params)
head_replication_document(
        self,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication.read

Rate limit

This operation consumes one read request.

Request

Instantiate the HeadReplicationDocumentOptions struct and set the fields to provide parameter values for the HeadReplicationDocument method.

Use the HeadReplicationDocumentOptions.Builder to create a HeadReplicationDocumentOptions object that contains the parameter values for the headReplicationDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The HeadReplicationDocument options.

The headReplicationDocument options.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/_replicator/repldoc-example"
    
  • headReplicationDocumentOptions := service.NewHeadReplicationDocumentOptions(
      "repldoc-example",
    )
    
    response, err := service.HeadReplicationDocument(headReplicationDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    fmt.Println(response.StatusCode)
    fmt.Println(response.Headers["Etag"])
    
  • import com.ibm.cloud.sdk.core.http.Headers;
    
    import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.HeadReplicationDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    HeadReplicationDocumentOptions replicationDocOptions =
        new HeadReplicationDocumentOptions.Builder()
            .docId("repldoc-example")
            .build();
    
    int statusCode =
        service.headReplicationDocument(replicationDocOptions).execute().getStatusCode();
    
    Headers headers =
        service.headReplicationDocument(replicationDocOptions).execute().getHeaders();
    
    System.out.println(statusCode);
    System.out.println(headers.values("ETag"));
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.headReplicationDocument({
      docId: 'repldoc-example'
    }).then(response => {
      console.log(response.status);
      console.log(response.headers['etag']);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.head_replication_document(
     doc_id='repldoc-example'
    )
    print(response.get_status_code())
    print(response.get_headers()['ETag'])
    

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for ReplicationDocument.

  • Document hasn't been modified since the specified revision.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create or modify a replication using a replication document

Creates or modifies a document in the _replicator database to start a new replication or to edit an existing replication.

Creates or modifies a document in the _replicator database to start a new replication or to edit an existing replication.

Creates or modifies a document in the _replicator database to start a new replication or to edit an existing replication.

Creates or modifies a document in the _replicator database to start a new replication or to edit an existing replication.

Creates or modifies a document in the _replicator database to start a new replication or to edit an existing replication.

PUT /_replicator/{doc_id}
(cloudant *CloudantV1) PutReplicationDocument(putReplicationDocumentOptions *PutReplicationDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutReplicationDocumentWithContext(ctx context.Context, putReplicationDocumentOptions *PutReplicationDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> putReplicationDocument(PutReplicationDocumentOptions putReplicationDocumentOptions)
putReplicationDocument(params)
put_replication_document(
        self,
        doc_id: str,
        replication_document: 'ReplicationDocument',
        *,
        if_match: Optional[str] = None,
        batch: Optional[str] = None,
        new_edits: Optional[bool] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PutReplicationDocumentOptions struct and set the fields to provide parameter values for the PutReplicationDocument method.

Use the PutReplicationDocumentOptions.Builder to create a PutReplicationDocumentOptions object that contains the parameter values for the putReplicationDocument method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

HTTP request body for replication operations.

Examples:
ReplicationDocument

WithContext method only

The PutReplicationDocument options.

The putReplicationDocument options.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.

    Default: false

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/_replicator/repldoc-example" -H "Content-Type: application/json" --data '{
      "_id": "repldoc-example",
      "create_target": true,
      "source": {
        "url": "'"$SOURCE_SERVICE_URL/animaldb"'"
      },
      "target": {
        "auth": {
          "iam": {
            "api_key": "'"$API_KEY"'"
          }
        },
        "url": "'"$TARGET_SERVICE_URL/animaldb-target"'"
      }
    }'
    
  • This example requires an import for github.com/IBM/go-sdk-core/v5/core.

    source, err := service.NewReplicationDatabase(
      "<your-source-service-url>/animaldb",
    )
    if err != nil {
      panic(err)
    }
    
    target, err := service.NewReplicationDatabase(
      "<your-target-service-url>" + "/" + "animaldb-target",
    )
    if err != nil {
      panic(err)
    }
    
    auth, err := service.NewReplicationDatabaseAuthIam(
      "<your-iam-api-key>",
    )
    if err != nil {
      panic(err)
    }
    target.Auth = &cloudantv1.ReplicationDatabaseAuth{Iam: auth}
    
    replicationDoc, err := service.NewReplicationDocument(
      source,
      target,
    )
    if err != nil {
      panic(err)
    }
    
    replicationDoc.CreateTarget = core.BoolPtr(true)
    
    putReplicationDocumentOptions := service.NewPutReplicationDocumentOptions(
      "repldoc-example",
      replicationDoc,
    )
    
    documentResult, response, err := service.PutReplicationDocument(putReplicationDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PutReplicationDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.ReplicationDatabase;
    import com.ibm.cloud.cloudant.v1.model.ReplicationDatabaseAuth;
    import com.ibm.cloud.cloudant.v1.model.ReplicationDatabaseAuthIam;
    import com.ibm.cloud.cloudant.v1.model.ReplicationDocument;
    
    Cloudant service = Cloudant.newInstance();
    
    ReplicationDatabase sourceDb = new ReplicationDatabase.Builder()
        .url("<your-source-service-url>/animaldb")
        .build();
    
    ReplicationDatabaseAuthIam targetAuthIam =
        new ReplicationDatabaseAuthIam.Builder()
            .apiKey("<your-iam-api-key>")
            .build();
    
    ReplicationDatabaseAuth targetAuth = new ReplicationDatabaseAuth.Builder()
        .iam(targetAuthIam)
        .build();
    
    ReplicationDatabase targetDb = new ReplicationDatabase.Builder()
        .auth(targetAuth)
        .url(String.join("/","<your-target-service-url>", "animaldb-target"))
        .build();
    
    ReplicationDocument replDocument = new ReplicationDocument();
    replDocument.setCreateTarget(true);
    replDocument.setSource(sourceDb);
    replDocument.setTarget(targetDb);
    
    PutReplicationDocumentOptions replicationDocumentOptions =
        new PutReplicationDocumentOptions.Builder()
            .docId("repldoc-example")
            .replicationDocument(replDocument)
            .build();
    
    DocumentResult response =
        service.putReplicationDocument(replicationDocumentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const sourceDb: CloudantV1.ReplicationDatabase = {
      url: '<your-source-service-url>/animaldb'
    };
    
    const targetDb: CloudantV1.ReplicationDatabase = {
      auth: {
        iam: {
          'apiKey': '<your-iam-api-key>'
        }
      },
      url: '<your-target-service-url>' + '/' + 'animaldb-target'
    };
    
    const replDocument: CloudantV1.ReplicationDocument = {
      id: 'repldoc-example',
      createTarget: true,
      source: sourceDb,
      target: targetDb
    }
    
    service.putReplicationDocument({
      docId: 'repldoc-example',
      replicationDocument: replDocument
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1, ReplicationDocument, ReplicationDatabase, ReplicationDatabaseAuthIam, ReplicationDatabaseAuth
    
    service = CloudantV1.new_instance()
    
    source_db = ReplicationDatabase(
      url='<your-source-service-url>/animaldb'
    )
    
    target_auth_iam = ReplicationDatabaseAuthIam(
      api_key='<your-iam-api-key>'
    )
    target_auth = ReplicationDatabaseAuth(
      iam=target_auth_iam
    )
    target_db = ReplicationDatabase(
      auth=target_auth,
      url='<your-target-service-url>/animaldb-target'
    )
    
    replication_document = ReplicationDocument(
      _id='repldoc-example',
      create_target=True,
      source=source_db,
      target=target_db
    )
    
    response = service.put_replication_document(
      doc_id='repldoc-example',
      replication_document=replication_document
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve replication scheduler documents

Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.

Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.

Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.

Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.

Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.

GET /_scheduler/docs
(cloudant *CloudantV1) GetSchedulerDocs(getSchedulerDocsOptions *GetSchedulerDocsOptions) (result *SchedulerDocsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSchedulerDocsWithContext(ctx context.Context, getSchedulerDocsOptions *GetSchedulerDocsOptions) (result *SchedulerDocsResult, response *core.DetailedResponse, err error)
ServiceCall<SchedulerDocsResult> getSchedulerDocs(GetSchedulerDocsOptions getSchedulerDocsOptions)
getSchedulerDocs(params)
get_scheduler_docs(
        self,
        *,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        states: Optional[List[str]] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

Instantiate the GetSchedulerDocsOptions struct and set the fields to provide parameter values for the GetSchedulerDocs method.

Use the GetSchedulerDocsOptions.Builder to create a GetSchedulerDocsOptions object that contains the parameter values for the getSchedulerDocs method.

Query Parameters

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to include only replication documents in the specified states. String must be a comma-delimited string.

    Allowable values: [initializing,error,pending,running,crashing,completed,failed]

WithContext method only

The GetSchedulerDocs options.

The getSchedulerDocs options.

parameters

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to include only replication documents in the specified states. String must be a comma-delimited string.

    Allowable values: [initializing,error,pending,running,crashing,completed,failed]

parameters

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to include only replication documents in the specified states. String must be a comma-delimited string.

    Allowable values: [initializing,error,pending,running,crashing,completed,failed]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_scheduler/docs?limit=100&states=completed"
    
  • getSchedulerDocsOptions := service.NewGetSchedulerDocsOptions()
    getSchedulerDocsOptions.SetLimit(100)
    getSchedulerDocsOptions.SetStates([]string{"completed"})
    
    schedulerDocsResult, response, err := service.GetSchedulerDocs(getSchedulerDocsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(schedulerDocsResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetSchedulerDocsOptions;
    import com.ibm.cloud.cloudant.v1.model.SchedulerDocsResult;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    GetSchedulerDocsOptions schedulerDocsOptions = new GetSchedulerDocsOptions.Builder()
        .limit(100)
        .states(Arrays.asList("completed"))
        .build();
    
    SchedulerDocsResult response =
        service.getSchedulerDocs(schedulerDocsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    const service = CloudantV1.newInstance({});
    
    service.getSchedulerDocs({
      limit: 100,
      states: ['completed']
    }).then(response => {
      console.log(response.result);
    })
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_scheduler_docs(
      limit=100,
      states=['completed']
    ).get_result()
    
    print(response)
    

Response

Schema for a listing of replication scheduler documents.

Schema for a listing of replication scheduler documents.

Schema for a listing of replication scheduler documents.

Schema for a listing of replication scheduler documents.

Schema for a listing of replication scheduler documents.

Status Code

  • HTTP response for /_scheduler/docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SchedulerDocsResult response.

    {
      "docs": [
        {
          "database": "_replicator",
          "doc_id": "repldoc-example",
          "error_count": 0,
          "id": null,
          "info": {
            "changes_pending": null,
            "checkpointed_source_seq": "14-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGcyJrLlCAPS3RKM0wOZWwdlQrDHFbkeQAJJPqobYwgm2xMDIzTUuxJGwCqi2muG3JYwGSDA1ACmjRfoR_Uo2NUxOTzQmbQrR_IDYdgNgE9hMz2CZLc9MkC4tkwqZkAQCT-Yfn",
            "doc_write_failures": 0,
            "docs_read": 15,
            "docs_written": 15,
            "missing_revisions_found": 15,
            "revisions_checked": 15
          },
          "last_updated": "2020-06-04T20:05:30Z",
          "source": "https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb/",
          "start_time": "2020-06-04T20:05:24Z",
          "state": "completed",
          "target": "https://my-target-instance.cloudantnosqldb.appdomain.cloud.example/animaldb-target/"
        }
      ],
      "offset": 0,
      "total_rows": 1
    }
  • Example SchedulerDocsResult response.

    {
      "docs": [
        {
          "database": "_replicator",
          "doc_id": "repldoc-example",
          "error_count": 0,
          "id": null,
          "info": {
            "changes_pending": null,
            "checkpointed_source_seq": "14-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGcyJrLlCAPS3RKM0wOZWwdlQrDHFbkeQAJJPqobYwgm2xMDIzTUuxJGwCqi2muG3JYwGSDA1ACmjRfoR_Uo2NUxOTzQmbQrR_IDYdgNgE9hMz2CZLc9MkC4tkwqZkAQCT-Yfn",
            "doc_write_failures": 0,
            "docs_read": 15,
            "docs_written": 15,
            "missing_revisions_found": 15,
            "revisions_checked": 15
          },
          "last_updated": "2020-06-04T20:05:30Z",
          "source": "https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb/",
          "start_time": "2020-06-04T20:05:24Z",
          "state": "completed",
          "target": "https://my-target-instance.cloudantnosqldb.appdomain.cloud.example/animaldb-target/"
        }
      ],
      "offset": 0,
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for replication scheduler documents

Retrieves the HTTP headers for replication scheduler documents.

HEAD /_scheduler/docs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_scheduler/docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve a replication scheduler document

Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.

Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.

Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.

Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.

Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.

GET /_scheduler/docs/_replicator/{doc_id}
(cloudant *CloudantV1) GetSchedulerDocument(getSchedulerDocumentOptions *GetSchedulerDocumentOptions) (result *SchedulerDocument, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSchedulerDocumentWithContext(ctx context.Context, getSchedulerDocumentOptions *GetSchedulerDocumentOptions) (result *SchedulerDocument, response *core.DetailedResponse, err error)
ServiceCall<SchedulerDocument> getSchedulerDocument(GetSchedulerDocumentOptions getSchedulerDocumentOptions)
getSchedulerDocument(params)
get_scheduler_document(
        self,
        doc_id: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

Instantiate the GetSchedulerDocumentOptions struct and set the fields to provide parameter values for the GetSchedulerDocument method.

Use the GetSchedulerDocumentOptions.Builder to create a GetSchedulerDocumentOptions object that contains the parameter values for the getSchedulerDocument method.

Path Parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The GetSchedulerDocument options.

The getSchedulerDocument options.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_scheduler/docs/_replicator/repldoc-example"
    
  • getSchedulerDocumentOptions := service.NewGetSchedulerDocumentOptions(
      "repldoc-example",
    )
    
    schedulerDocument, response, err := service.GetSchedulerDocument(getSchedulerDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(schedulerDocument, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetSchedulerDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.SchedulerDocument;
    
    Cloudant service = Cloudant.newInstance();
    
    GetSchedulerDocumentOptions schedulerDocumentOptions =
        new GetSchedulerDocumentOptions.Builder()
            .docId("repldoc-example")
            .build();
    
    SchedulerDocument response =
        service.getSchedulerDocument(schedulerDocumentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getSchedulerDocument({
      docId: 'repldoc-example'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_scheduler_document(doc_id='repldoc-example').get_result()
    
    print(response)
    

Response

Schema for a replication scheduler document.

Schema for a replication scheduler document.

Schema for a replication scheduler document.

Schema for a replication scheduler document.

Schema for a replication scheduler document.

Status Code

  • HTTP response for /_scheduler/docs/_replicator/{doc_id} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SchedulerDocResult response.

    {
      "database": "_replicator",
      "doc_id": "repldoc-example",
      "error_count": 0,
      "id": null,
      "info": {
        "changes_pending": null,
        "checkpointed_source_seq": "14-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGcyJrLlCAPS3RKM0wOZWwdlQrDHFbkeQAJJPqobYwgm2xMDIzTUuxJGwCqi2muG3JYwGSDA1ACmjRfoR_Uo2NUxOTzQmbQrR_IDYdgNgE9hMz2CZLc9MkC4tkwqZkAQCT-Yfn",
        "doc_write_failures": 0,
        "docs_read": 15,
        "docs_written": 15,
        "missing_revisions_found": 15,
        "revisions_checked": 15
      },
      "last_updated": "2017-04-29T05:01:37.000Z",
      "source": "https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb/",
      "start_time": "2020-06-04T20:05:24Z",
      "state": "completed",
      "target": "https://my-target-instance.cloudantnosqldb.appdomain.cloud.example/animaldb-target/"
    }
  • Example SchedulerDocResult response.

    {
      "database": "_replicator",
      "doc_id": "repldoc-example",
      "error_count": 0,
      "id": null,
      "info": {
        "changes_pending": null,
        "checkpointed_source_seq": "14-g1AAAAGjeJzLYWBgYMlgTmGQT0lKzi9KdUhJMtFLykxPyilN1UvOyS9NScwr0ctLLckBKmRKZEiy____f1YGcyJrLlCAPS3RKM0wOZWwdlQrDHFbkeQAJJPqobYwgm2xMDIzTUuxJGwCqi2muG3JYwGSDA1ACmjRfoR_Uo2NUxOTzQmbQrR_IDYdgNgE9hMz2CZLc9MkC4tkwqZkAQCT-Yfn",
        "doc_write_failures": 0,
        "docs_read": 15,
        "docs_written": 15,
        "missing_revisions_found": 15,
        "revisions_checked": 15
      },
      "last_updated": "2017-04-29T05:01:37.000Z",
      "source": "https://my-source-instance.cloudantnosqldb.appdomain.cloud.example/animaldb/",
      "start_time": "2020-06-04T20:05:24Z",
      "state": "completed",
      "target": "https://my-target-instance.cloudantnosqldb.appdomain.cloud.example/animaldb-target/"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a replication scheduler document

Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.

HEAD /_scheduler/docs/_replicator/{doc_id}
(cloudant *CloudantV1) HeadSchedulerDocument(headSchedulerDocumentOptions *HeadSchedulerDocumentOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadSchedulerDocumentWithContext(ctx context.Context, headSchedulerDocumentOptions *HeadSchedulerDocumentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headSchedulerDocument(HeadSchedulerDocumentOptions headSchedulerDocumentOptions)
headSchedulerDocument(params)
head_scheduler_document(
        self,
        doc_id: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

Instantiate the HeadSchedulerDocumentOptions struct and set the fields to provide parameter values for the HeadSchedulerDocument method.

Use the HeadSchedulerDocumentOptions.Builder to create a HeadSchedulerDocumentOptions object that contains the parameter values for the headSchedulerDocument method.

Path Parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The HeadSchedulerDocument options.

The headSchedulerDocument options.

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

parameters

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_scheduler/docs/_replicator/{doc_id} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve replication scheduler jobs

Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn't include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.

Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn't include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.

Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn't include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.

Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn't include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.

Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn't include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.

GET /_scheduler/jobs
(cloudant *CloudantV1) GetSchedulerJobs(getSchedulerJobsOptions *GetSchedulerJobsOptions) (result *SchedulerJobsResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSchedulerJobsWithContext(ctx context.Context, getSchedulerJobsOptions *GetSchedulerJobsOptions) (result *SchedulerJobsResult, response *core.DetailedResponse, err error)
ServiceCall<SchedulerJobsResult> getSchedulerJobs(GetSchedulerJobsOptions getSchedulerJobsOptions)
getSchedulerJobs(params)
get_scheduler_jobs(
        self,
        *,
        limit: Optional[int] = None,
        skip: Optional[int] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

Instantiate the GetSchedulerJobsOptions struct and set the fields to provide parameter values for the GetSchedulerJobs method.

Use the GetSchedulerJobsOptions.Builder to create a GetSchedulerJobsOptions object that contains the parameter values for the getSchedulerJobs method.

Query Parameters

  • Query parameter to specify the number of returned jobs to limit the result to.

    Possible values: 0 ≤ value ≤ 200

    Default: 25

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

WithContext method only

The GetSchedulerJobs options.

The getSchedulerJobs options.

parameters

  • Query parameter to specify the number of returned jobs to limit the result to.

    Possible values: 0 ≤ value ≤ 200

    Default: 25

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

parameters

  • Query parameter to specify the number of returned jobs to limit the result to.

    Possible values: 0 ≤ value ≤ 200

    Default: 25

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_scheduler/jobs?limit=100"
    
  • getSchedulerJobsOptions := service.NewGetSchedulerJobsOptions()
    getSchedulerJobsOptions.SetLimit(100)
    
    schedulerJobsResult, response, err := service.GetSchedulerJobs(getSchedulerJobsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(schedulerJobsResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetSchedulerJobsOptions;
    import com.ibm.cloud.cloudant.v1.model.SchedulerJobsResult;
    
    Cloudant service = Cloudant.newInstance();
    
    GetSchedulerJobsOptions schedulerJobsOptions =
        new GetSchedulerJobsOptions.Builder()
            .limit(100)
            .build();
    
    SchedulerJobsResult response =
        service.getSchedulerJobs(schedulerJobsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getSchedulerJobs({
      limit: 100
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_scheduler_jobs(
      limit=100
    ).get_result()
    
    print(response)
    

Response

Schema for a listing of replication scheduler jobs.

Schema for a listing of replication scheduler jobs.

Schema for a listing of replication scheduler jobs.

Schema for a listing of replication scheduler jobs.

Schema for a listing of replication scheduler jobs.

Status Code

  • HTTP response for /_scheduler/jobs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SchedulerJobsResult response.

    {
      "jobs": [
        {
          "database": "_replicator",
          "doc_id": "cdyno-0000001-0000003",
          "history": [
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "started"
            },
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "added"
            }
          ],
          "id": "8f5b1bd0be6f9166ccfd36fc8be8fc22+continuous",
          "info": {
            "changes_pending": null,
            "checkpointed_source_seq": "1-g1AAAARheJzLYWBgEMhgTmHQTElKzi9KdUhJMtJLytVNTtYtLdYtzi8tydA1stBLzskvTUnMK9HLSy3JAWphSmRI4v",
            "doc_write_failures": 0,
            "docs_read": 12,
            "docs_written": 12,
            "missing_revisions_found": 12,
            "revisions_checked": 12,
            "source_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg",
            "through_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg"
          },
          "node": "node1@127.0.0.1",
          "pid": "<0.1850.0>",
          "source": "http://myserver.com/foo",
          "start_time": "2017-04-29T05:01:37Z",
          "target": "http://adm:*****@localhost:15984/cdyno-0000003/",
          "user": null
        },
        {
          "database": "_replicator",
          "doc_id": "cdyno-0000001-0000002",
          "history": [
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "started"
            },
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "added"
            }
          ],
          "id": "e327d79214831ca4c11550b4a453c9ba+continuous",
          "info": {
            "changes_pending": null,
            "checkpointed_source_seq": "1-g1AAAASbeJzLYWBgEMhgTmHQTElKzi9KdUhJMtJLytVNTtYtLdYtzi8tydA1stBLzskvTUnMK9HLSy3JAWphSmRI4v",
            "doc_write_failures": 0,
            "docs_read": 12,
            "docs_written": 12,
            "missing_revisions_found": 12,
            "revisions_checked": 12,
            "source_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg",
            "through_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg"
          },
          "node": "node2@127.0.0.1",
          "pid": "<0.1757.0>",
          "source": "http://myserver.com/foo",
          "start_time": "2017-04-29T05:01:37Z",
          "target": "http://adm:*****@localhost:15984/cdyno-0000002/",
          "user": null
        }
      ],
      "offset": 0,
      "total_rows": 2
    }
  • Example SchedulerJobsResult response.

    {
      "jobs": [
        {
          "database": "_replicator",
          "doc_id": "cdyno-0000001-0000003",
          "history": [
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "started"
            },
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "added"
            }
          ],
          "id": "8f5b1bd0be6f9166ccfd36fc8be8fc22+continuous",
          "info": {
            "changes_pending": null,
            "checkpointed_source_seq": "1-g1AAAARheJzLYWBgEMhgTmHQTElKzi9KdUhJMtJLytVNTtYtLdYtzi8tydA1stBLzskvTUnMK9HLSy3JAWphSmRI4v",
            "doc_write_failures": 0,
            "docs_read": 12,
            "docs_written": 12,
            "missing_revisions_found": 12,
            "revisions_checked": 12,
            "source_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg",
            "through_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg"
          },
          "node": "node1@127.0.0.1",
          "pid": "<0.1850.0>",
          "source": "http://myserver.com/foo",
          "start_time": "2017-04-29T05:01:37Z",
          "target": "http://adm:*****@localhost:15984/cdyno-0000003/",
          "user": null
        },
        {
          "database": "_replicator",
          "doc_id": "cdyno-0000001-0000002",
          "history": [
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "started"
            },
            {
              "timestamp": "2017-04-29T05:01:37Z",
              "type": "added"
            }
          ],
          "id": "e327d79214831ca4c11550b4a453c9ba+continuous",
          "info": {
            "changes_pending": null,
            "checkpointed_source_seq": "1-g1AAAASbeJzLYWBgEMhgTmHQTElKzi9KdUhJMtJLytVNTtYtLdYtzi8tydA1stBLzskvTUnMK9HLSy3JAWphSmRI4v",
            "doc_write_failures": 0,
            "docs_read": 12,
            "docs_written": 12,
            "missing_revisions_found": 12,
            "revisions_checked": 12,
            "source_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg",
            "through_seq": "12-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg"
          },
          "node": "node2@127.0.0.1",
          "pid": "<0.1757.0>",
          "source": "http://myserver.com/foo",
          "start_time": "2017-04-29T05:01:37Z",
          "target": "http://adm:*****@localhost:15984/cdyno-0000002/",
          "user": null
        }
      ],
      "offset": 0,
      "total_rows": 2
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for replication scheduler jobs

Retrieves the HTTP headers for replication scheduler jobs.

HEAD /_scheduler/jobs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_scheduler/jobs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve a replication scheduler job

Retrieves the state of a single replication task based on its replication ID

Retrieves the state of a single replication task based on its replication ID.

Retrieves the state of a single replication task based on its replication ID.

Retrieves the state of a single replication task based on its replication ID.

Retrieves the state of a single replication task based on its replication ID.

GET /_scheduler/jobs/{job_id}
(cloudant *CloudantV1) GetSchedulerJob(getSchedulerJobOptions *GetSchedulerJobOptions) (result *SchedulerJob, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSchedulerJobWithContext(ctx context.Context, getSchedulerJobOptions *GetSchedulerJobOptions) (result *SchedulerJob, response *core.DetailedResponse, err error)
ServiceCall<SchedulerJob> getSchedulerJob(GetSchedulerJobOptions getSchedulerJobOptions)
getSchedulerJob(params)
get_scheduler_job(
        self,
        job_id: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

Instantiate the GetSchedulerJobOptions struct and set the fields to provide parameter values for the GetSchedulerJob method.

Use the GetSchedulerJobOptions.Builder to create a GetSchedulerJobOptions object that contains the parameter values for the getSchedulerJob method.

Path Parameters

  • Path parameter to specify the replication job id.

WithContext method only

The GetSchedulerJob options.

The getSchedulerJob options.

parameters

  • Path parameter to specify the replication job id.

parameters

  • Path parameter to specify the replication job id.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_scheduler/jobs/$JOB_ID?limit=100"
    
  • getSchedulerJobOptions := service.NewGetSchedulerJobOptions(
      "7b94915cd8c4a0173c77c55cd0443939+continuous",
    )
    
    schedulerJob, response, err := service.GetSchedulerJob(getSchedulerJobOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(schedulerJob, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetSchedulerJobOptions;
    import com.ibm.cloud.cloudant.v1.model.SchedulerJob;
    
    Cloudant service = Cloudant.newInstance();
    
    GetSchedulerJobOptions schedulerJobOptions =
        new GetSchedulerJobOptions.Builder()
            .jobId("7b94915cd8c4a0173c77c55cd0443939+continuous")
            .build();
    
    SchedulerJob response =
        service.getSchedulerJob(schedulerJobOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getSchedulerJob({
      jobId: '7b94915cd8c4a0173c77c55cd0443939+continuous'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_scheduler_job(
      job_id='7b94915cd8c4a0173c77c55cd0443939+continuous'
    ).get_result()
    
    print(response)
    

Response

Schema for a replication scheduler job.

Schema for a replication scheduler job.

Schema for a replication scheduler job.

Schema for a replication scheduler job.

Schema for a replication scheduler job.

Status Code

  • HTTP response for SchedulerJob.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SchedulerJob response.

    {
      "database": "_replicator",
      "doc_id": "15972f3ef583b3cd6b6620ae4a91b6c5",
      "history": [
        {
          "timestamp": "2022-04-29T05:01:37Z",
          "type": "started"
        },
        {
          "timestamp": "2022-04-29T05:01:37Z",
          "type": "added"
        }
      ],
      "id": "935c58f9ff98aabe5340d8cb8946f5ca+create_target",
      "info": {
        "changes_pending": null,
        "checkpointed_source_seq": "1-g1AAAARheJzLYWBgEMhgTmHQTElKzi9KdUhJMtJLyt__VNTtYtLdYtzi8tydA1stBLzskvTUnMK9HLSy3JAWphSmRI4v",
        "doc_write_failures": 0,
        "docs_read": 2710,
        "docs_written": 2710,
        "missing_revisions_found": 12,
        "revisions_checked": 12,
        "source_seq": "1037-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9___szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg",
        "through_seq": "667-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJB"
      },
      "node": "node1@127.0.0.1",
      "pid": "<0.1850.0>",
      "source": "http://myserver.com/db",
      "start_time": "2017-04-29T05:01:37Z",
      "target": "http://adm:*****@localhost:15984/mydb/",
      "user": null
    }
  • Example SchedulerJob response.

    {
      "database": "_replicator",
      "doc_id": "15972f3ef583b3cd6b6620ae4a91b6c5",
      "history": [
        {
          "timestamp": "2022-04-29T05:01:37Z",
          "type": "started"
        },
        {
          "timestamp": "2022-04-29T05:01:37Z",
          "type": "added"
        }
      ],
      "id": "935c58f9ff98aabe5340d8cb8946f5ca+create_target",
      "info": {
        "changes_pending": null,
        "checkpointed_source_seq": "1-g1AAAARheJzLYWBgEMhgTmHQTElKzi9KdUhJMtJLyt__VNTtYtLdYtzi8tydA1stBLzskvTUnMK9HLSy3JAWphSmRI4v",
        "doc_write_failures": 0,
        "docs_read": 2710,
        "docs_written": 2710,
        "missing_revisions_found": 12,
        "revisions_checked": 12,
        "source_seq": "1037-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9___szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJBg",
        "through_seq": "667-g1AAAACTeJzLYWBgYMpgTmHgz8tPSTV0MDQy1zMAQsMckEQiQ1L9____szKYE1lzgQLsBsZm5pZJJpjKcRqRxwIkGRqA1H-oSexgk4yMkhITjS0wdWUBADfEJB"
      },
      "node": "node1@127.0.0.1",
      "pid": "<0.1850.0>",
      "source": "http://myserver.com/db",
      "start_time": "2017-04-29T05:01:37Z",
      "target": "http://adm:*****@localhost:15984/mydb/",
      "user": null
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for a replication scheduler job

Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.

HEAD /_scheduler/jobs/{job_id}
(cloudant *CloudantV1) HeadSchedulerJob(headSchedulerJobOptions *HeadSchedulerJobOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadSchedulerJobWithContext(ctx context.Context, headSchedulerJobOptions *HeadSchedulerJobOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headSchedulerJob(HeadSchedulerJobOptions headSchedulerJobOptions)
headSchedulerJob(params)
head_scheduler_job(
        self,
        job_id: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.replication-scheduler.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.replication-scheduler.read

Request

Instantiate the HeadSchedulerJobOptions struct and set the fields to provide parameter values for the HeadSchedulerJob method.

Use the HeadSchedulerJobOptions.Builder to create a HeadSchedulerJobOptions object that contains the parameter values for the headSchedulerJob method.

Path Parameters

  • Path parameter to specify the replication job id.

WithContext method only

The HeadSchedulerJob options.

The headSchedulerJob options.

parameters

  • Path parameter to specify the replication job id.

parameters

  • Path parameter to specify the replication job id.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/_scheduler/jobs/$JOB_ID"
    
  • headSchedulerJobOptions := service.NewHeadSchedulerJobOptions(
      "7b94915cd8c4a0173c77c55cd0443939+continuous",
    )
    
    response, err := service.HeadSchedulerJob(headSchedulerJobOptions)
    if err != nil {
      panic(err)
    }
    
    fmt.Println(response.StatusCode)
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.HeadSchedulerJobOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    HeadSchedulerJobOptions schedulerJobOptions =
        new HeadSchedulerJobOptions.Builder()
            .jobId("7b94915cd8c4a0173c77c55cd0443939+continuous")
            .build();
    
    int statusCode =
        service.headSchedulerJob(schedulerJobOptions).execute()
            .getStatusCode();
    
    System.out.println(statusCode);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.headSchedulerJob({
      jobId: '7b94915cd8c4a0173c77c55cd0443939+continuous'
    }).then(response => {
      console.log(response.status);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.head_scheduler_job(
      job_id='7b94915cd8c4a0173c77c55cd0443939+continuous'
    ).get_result()
    
    print(response.get_status_code())
    

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for SchedulerJob.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Delete a session cookie

Returns a response that instructs the HTTP client to clear the cookie. The session cookies are stateless and cannot be invalidated; hence, this operation is optional and does not invalidate the cookie on the server.

DELETE /_session

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.session.delete

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.session.delete

Request

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/_session"
    

    For more details on Session Authentication, see Authentication.

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve current session cookie information

Retrieves information about the authenticated user's session.

Retrieves information about the authenticated user's session.

Retrieves information about the authenticated user's session.

Retrieves information about the authenticated user's session.

Retrieves information about the authenticated user's session.

GET /_session
(cloudant *CloudantV1) GetSessionInformation(getSessionInformationOptions *GetSessionInformationOptions) (result *SessionInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSessionInformationWithContext(ctx context.Context, getSessionInformationOptions *GetSessionInformationOptions) (result *SessionInformation, response *core.DetailedResponse, err error)
ServiceCall<SessionInformation> getSessionInformation()
getSessionInformation(params)
get_session_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.session.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.session.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_session"
    

    For more details on Session Authentication, see Authentication.

  • getSessionInformationOptions := service.NewGetSessionInformationOptions()
    
    sessionInformation, response, err := service.GetSessionInformation(getSessionInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(sessionInformation, "", "  ")
    fmt.Println(string(b))
    

    For more details on Session Authentication, see Authentication.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.SessionInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    SessionInformation response =
        service.getSessionInformation().execute().getResult();
    
    System.out.println(response);
    

    For more details on Session Authentication, see Authentication.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getSessionInformation().then(response => {
      console.log(response.result);
    });
    

    For more details on Session Authentication, see Authentication.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_session_information().get_result()
    
    print(response)
    

    For more details on Session Authentication, see Authentication.

Response

Schema for information about a session.

Schema for information about a session.

Schema for information about a session.

Schema for information about a session.

Schema for information about a session.

Status Code

  • HTTP response for /_session style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SessionInformation response.

    {
      "info": {
        "authenticated": "default",
        "authentication_db": "_users",
        "authentication_handlers": [
          "iam",
          "cookie",
          "default",
          "local"
        ]
      },
      "ok": true,
      "userCtx": {
        "name": "user",
        "roles": [
          "_admin",
          "_reader",
          "_writer"
        ]
      }
    }
  • Example SessionInformation response.

    {
      "info": {
        "authenticated": "default",
        "authentication_db": "_users",
        "authentication_handlers": [
          "iam",
          "cookie",
          "default",
          "local"
        ]
      },
      "ok": true,
      "userCtx": {
        "name": "user",
        "roles": [
          "_admin",
          "_reader",
          "_writer"
        ]
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for the current session cookie

Retrieves the HTTP headers for the authenticated user's session.

HEAD /_session

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.session.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.session.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_session style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create a session cookie

Response returns a cookie, generated by the server, that confirms you have successfully authenticated. Once the cookie is created, you send the cookie with all requests that require you to be authenticated. The presence of a valid cookie is sufficient to ensure that your call request is processed rather than rejected immediately as unauthenticated. You can use the cookie until it expires.

POST /_session

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.session.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.session.write

Request

Query Parameters

  • Enforces redirect after successful login to the specified location. This location is relative from server root.

HTTP request body for postSession.

  • curl -X POST "$SERVICE_URL/_session" -H "Content-Type: application/json" --data '{
      "username": "'"$SERVICE_USERNAME"'",
      "password": "'"$SERVICE_PASSWORD"'"
    }'
    

    For more details on Session Authentication, see Authentication.

Response

Schema for the result of requesting a session.

Status Code

  • HTTP response for postSession.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example SessionResult response.

    {
      "name": "user",
      "ok": true,
      "roles": [
        "_reader",
        "_writer"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete an IAM cookie session

Returns a response that instructs the HTTP client to clear the cookie. The session cookies are stateless and cannot be invalidated; hence, this operation is optional and does not invalidate the cookie on the server.

DELETE /_iam_session

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.iam-session.delete

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.iam-session.delete

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve current IAM cookie session information

Retrieves information about an IAM cookie session.

GET /_iam_session

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.iam-session.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.iam-session.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for information about an IAM session.

Status Code

  • HTTP response for getIamSessionInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example IamSessionInformation response.

    {
      "id": "abc-123",
      "ok": true,
      "scope": "ibm openid",
      "type": "user"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Create a session cookie by using an IAM token

Log in by exchanging an IAM token for an IBM Cloudant cookie.

POST /_iam_session

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.iam-session.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.iam-session.write

Request

HTTP request body for postIamSession.

Examples:
IamSessionConfiguration

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve database permissions information

See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.

See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.

See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.

See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.

See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.

GET /{db}/_security
(cloudant *CloudantV1) GetSecurity(getSecurityOptions *GetSecurityOptions) (result *Security, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetSecurityWithContext(ctx context.Context, getSecurityOptions *GetSecurityOptions) (result *Security, response *core.DetailedResponse, err error)
ServiceCall<Security> getSecurity(GetSecurityOptions getSecurityOptions)
getSecurity(params)
get_security(
        self,
        db: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-security.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-security.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetSecurityOptions struct and set the fields to provide parameter values for the GetSecurity method.

Use the GetSecurityOptions.Builder to create a GetSecurityOptions object that contains the parameter values for the getSecurity method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

WithContext method only

The GetSecurity options.

The getSecurity options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_security"
    
  • getSecurityOptions := service.NewGetSecurityOptions(
      "products",
    )
    
    security, response, err := service.GetSecurity(getSecurityOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(security, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetSecurityOptions;
    import com.ibm.cloud.cloudant.v1.model.Security;
    
    Cloudant service = Cloudant.newInstance();
    
    GetSecurityOptions securityOptions =
        new GetSecurityOptions.Builder()
            .db("products")
            .build();
    
    Security response =
        service.getSecurity(securityOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getSecurity({
      db: 'products'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_security(
      db='products'
    ).get_result()
    
    print(response)
    

Response

Schema for a security document.

Schema for a security document.

Schema for a security document.

Schema for a security document.

Schema for a security document.

Status Code

  • HTTP response for getSecurity and getCloudantSecurityInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Cloudant Security response.

    {
      "cloudant": {
        "nobody": [
          "_replicator",
          "_reader"
        ]
      }
    }
  • Example Cloudant Security response.

    {
      "cloudant": {
        "nobody": [
          "_replicator",
          "_reader"
        ]
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for database permissions information

Retrieves the HTTP headers for database permissions information. Since the response body is empty, using the HEAD method is a lightweight way to check if the current user has permission to access the database.

HEAD /{db}/_security

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-security.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-security.read

Rate limit

This operation consumes one read request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_security style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Modify database permissions

Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

PUT /{db}/_security
(cloudant *CloudantV1) PutSecurity(putSecurityOptions *PutSecurityOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutSecurityWithContext(ctx context.Context, putSecurityOptions *PutSecurityOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> putSecurity(PutSecurityOptions putSecurityOptions)
putSecurity(params)
put_security(
        self,
        db: str,
        *,
        admins: Optional['SecurityObject'] = None,
        members: Optional['SecurityObject'] = None,
        cloudant: Optional[dict] = None,
        couchdb_auth_only: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-security.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-security.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PutSecurityOptions struct and set the fields to provide parameter values for the PutSecurity method.

Use the PutSecurityOptions.Builder to create a PutSecurityOptions object that contains the parameter values for the putSecurity method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for putSecurity.

Examples:
Security

WithContext method only

The PutSecurity options.

The putSecurity options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for names and roles to map to a database permission.

  • Schema for names and roles to map to a database permission.

  • Database permissions for Cloudant users and/or API keys.

    Allowable values: [_reader,_writer,_admin,_replicator,_db_updates,_design,_shards,_security]

  • Manage permissions using the _users database only.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Schema for names and roles to map to a database permission.

  • Schema for names and roles to map to a database permission.

  • Database permissions for Cloudant users and/or API keys.

    Allowable values: [_reader,_writer,_admin,_replicator,_db_updates,_design,_shards,_security]

  • Manage permissions using the _users database only.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/products/_security" -H "Content-Type: application/json" --data '{
      "members": {
        "names": [
          "user1",
          "user2"
        ],
        "roles": [
          "developers"
        ]
      }
    }'
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • putSecurityOptions := service.NewPutSecurityOptions(
      "products",
    )
    putSecurityOptions.SetMembers(&cloudantv1.SecurityObject{
      Names: []string{"user1", "user2"},
      Roles: []string{"developers"},
    })
    
    ok, response, err := service.PutSecurity(putSecurityOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(ok, "", "  ")
    fmt.Println(string(b))
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    import com.ibm.cloud.cloudant.v1.model.PutSecurityOptions;
    import com.ibm.cloud.cloudant.v1.model.SecurityObject;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    SecurityObject members = new SecurityObject.Builder()
        .names(Arrays.asList("user1", "user2"))
        .roles(Arrays.asList("developers"))
        .build();
    
    PutSecurityOptions securityOptions =
        new PutSecurityOptions.Builder()
            .db("products")
            .members(members)
            .build();
    
    Ok response =
        service.putSecurity(securityOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const members: CloudantV1.SecurityObject = {
      names: ['user1', 'user2'],
      roles: ['developers']
    };
    
    service.putSecurity({
      db: 'products',
      members: members
    }).then(response => {
      console.log(response.result);
    });
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • from ibmcloudant.cloudant_v1 import CloudantV1, SecurityObject
    
    service = CloudantV1.new_instance()
    
    members = SecurityObject(
      names=['user1', 'user2'],
      roles=['developers']
    )
    
    response = service.put_security(
      db='products',
      members=members
    ).get_result()
    
    print(response)
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Generates API keys for apps or persons to enable database access

Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.

Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.

Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.

Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.

Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.

POST /_api/v2/api_keys
(cloudant *CloudantV1) PostApiKeys(postApiKeysOptions *PostApiKeysOptions) (result *ApiKeysResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostApiKeysWithContext(ctx context.Context, postApiKeysOptions *PostApiKeysOptions) (result *ApiKeysResult, response *core.DetailedResponse, err error)
ServiceCall<ApiKeysResult> postApiKeys()
postApiKeys(params)
post_api_keys(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.apikeys

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.apikeys

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/_api/v2/api_keys"
    
  • postApiKeysOptions := service.NewPostApiKeysOptions()
    
    apiKeysResult, response, err := service.PostApiKeys(postApiKeysOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(apiKeysResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ApiKeysResult;
    
    Cloudant service = Cloudant.newInstance();
    
    ApiKeysResult response =
        service.postApiKeys().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postApiKeys().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_api_keys().get_result()
    
    print(response)
    

Response

Schema for api keys.

Schema for api keys.

Schema for api keys.

Schema for api keys.

Schema for api keys.

Status Code

  • HTTP response for postApiKeys.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ApiKeysResult response.

    {
      "key": "blentfortedsionstrindigl",
      "ok": true,
      "password": "YPNCaIX1sJRX5upaL3eqvTfi"
    }
  • Example ApiKeysResult response.

    {
      "key": "blentfortedsionstrindigl",
      "ok": true,
      "password": "YPNCaIX1sJRX5upaL3eqvTfi"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve database permissions information

See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.

GET /_api/v2/db/{db}/_security

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.db-security

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.db-security

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_api/v2/db/products/_security"
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before getting permissions. For information on the _users database, see Using the _users database with Cloudant.

Response

Schema for a security document.

Status Code

  • HTTP response for getSecurity and getCloudantSecurityInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Cloudant Security response.

    {
      "cloudant": {
        "nobody": [
          "_replicator",
          "_reader"
        ]
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Modify only Cloudant related database permissions

Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database.

Note about nobody role

The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

PUT /_api/v2/db/{db}/_security
(cloudant *CloudantV1) PutCloudantSecurityConfiguration(putCloudantSecurityConfigurationOptions *PutCloudantSecurityConfigurationOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutCloudantSecurityConfigurationWithContext(ctx context.Context, putCloudantSecurityConfigurationOptions *PutCloudantSecurityConfigurationOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> putCloudantSecurityConfiguration(PutCloudantSecurityConfigurationOptions putCloudantSecurityConfigurationOptions)
putCloudantSecurityConfiguration(params)
put_cloudant_security_configuration(
        self,
        db: str,
        cloudant: dict,
        *,
        admins: Optional['SecurityObject'] = None,
        members: Optional['SecurityObject'] = None,
        couchdb_auth_only: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.db-security

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.db-security

Request

Instantiate the PutCloudantSecurityConfigurationOptions struct and set the fields to provide parameter values for the PutCloudantSecurityConfiguration method.

Use the PutCloudantSecurityConfigurationOptions.Builder to create a PutCloudantSecurityConfigurationOptions object that contains the parameter values for the putCloudantSecurityConfiguration method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for putCloudantSecurityConfiguration.

Examples:
CloudantSecurityConfiguration

WithContext method only

The PutCloudantSecurityConfiguration options.

The putCloudantSecurityConfiguration options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Database permissions for Cloudant users and/or API keys.

    Allowable values: [_reader,_writer,_admin,_replicator,_db_updates,_design,_shards,_security]

  • Schema for names and roles to map to a database permission.

  • Schema for names and roles to map to a database permission.

  • Manage permissions using the _users database only.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Database permissions for Cloudant users and/or API keys.

    Allowable values: [_reader,_writer,_admin,_replicator,_db_updates,_design,_shards,_security]

  • Schema for names and roles to map to a database permission.

  • Schema for names and roles to map to a database permission.

  • Manage permissions using the _users database only.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/_api/v2/db/products/_security" --data '{"nobody": ["_reader"]}'
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • putCloudantSecurityConfigurationOptions := service.NewPutCloudantSecurityConfigurationOptions(
      "products",
      map[string][]string{
        "nobody": {cloudantv1.SecurityCloudantReaderConst},
      },
    )
    
    ok, response, err := service.PutCloudantSecurityConfiguration(putCloudantSecurityConfigurationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(ok, "", "  ")
    fmt.Println(string(b))
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    import com.ibm.cloud.cloudant.v1.model.PutCloudantSecurityConfigurationOptions;
    
    import java.util.Arrays;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    Cloudant service = Cloudant.newInstance();
    
    Map<String, List<String>> securityObject = new HashMap<>();
    securityObject.put("nobody", Arrays.asList("_reader"));
    
    PutCloudantSecurityConfigurationOptions securityOptions =
        new PutCloudantSecurityConfigurationOptions.Builder()
            .db("products")
            .cloudant(securityObject)
            .build();
    
    Ok response =
        service.putCloudantSecurityConfiguration(securityOptions)
            .execute()
            .getResult();
    
    System.out.println(response);
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.putCloudantSecurityConfiguration({
      db: 'products',
      cloudant: {'nobody': ['_reader']}
    }).then(response => {
      console.log(response.result);
    });
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    security_object = {'nobody':['_reader']}
    response = service.put_cloudant_security_configuration(
      db='products',
      cloudant=security_object
    ).get_result()
    
    print(response)
    

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but didn't identify itself, the task can continue only if the nobody user has the role _reader.

    If instead of using Cloudant's security model for managing permissions you opt to use the Apache CouchDB _users database (that is using legacy credentials and the couchdb_auth_only:true option) then be aware that the user must already exist in _users database before adding permissions. For information on the _users database, see Using the _users database with Cloudant.

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve CORS configuration information

Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the server interact to determine whether or not to allow the request.

Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the server interact to determine whether or not to allow the request.

Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the server interact to determine whether or not to allow the request.

Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the server interact to determine whether or not to allow the request.

Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the server interact to determine whether or not to allow the request.

GET /_api/v2/user/config/cors
(cloudant *CloudantV1) GetCorsInformation(getCorsInformationOptions *GetCorsInformationOptions) (result *CorsInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetCorsInformationWithContext(ctx context.Context, getCorsInformationOptions *GetCorsInformationOptions) (result *CorsInformation, response *core.DetailedResponse, err error)
ServiceCall<CorsInformation> getCorsInformation()
getCorsInformation(params)
get_cors_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.usercors

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.usercors

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_api/v2/user/config/cors"
    
  • getCorsInformationOptions := service.NewGetCorsInformationOptions()
    
    corsConfiguration, response, err := service.GetCorsInformation(getCorsInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(corsConfiguration, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.CorsConfiguration;
    
    Cloudant service = Cloudant.newInstance();
    
    CorsConfiguration response =
        service.getCorsInformation().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getCorsInformation().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_cors_information().get_result()
    
    print(response)
    

Response

Schema for information about the CORS configuration.

Schema for information about the CORS configuration.

Schema for information about the CORS configuration.

Schema for information about the CORS configuration.

Schema for information about the CORS configuration.

Status Code

  • HTTP response for getCorsInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example CorsConfiguration request.

    {
      "allow_credentials": true,
      "enable_cors": true,
      "origins": [
        "https://example.com",
        "https://www.example.com"
      ]
    }
  • Example CorsConfiguration request.

    {
      "allow_credentials": true,
      "enable_cors": true,
      "origins": [
        "https://example.com",
        "https://www.example.com"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Modify CORS configuration

Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.

Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.

Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.

Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.

Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.

PUT /_api/v2/user/config/cors
(cloudant *CloudantV1) PutCorsConfiguration(putCorsConfigurationOptions *PutCorsConfigurationOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutCorsConfigurationWithContext(ctx context.Context, putCorsConfigurationOptions *PutCorsConfigurationOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> putCorsConfiguration(PutCorsConfigurationOptions putCorsConfigurationOptions)
putCorsConfiguration(params)
put_cors_configuration(
        self,
        origins: List[str],
        *,
        allow_credentials: Optional[bool] = None,
        enable_cors: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.usercors

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.usercors

Request

Instantiate the PutCorsConfigurationOptions struct and set the fields to provide parameter values for the PutCorsConfiguration method.

Use the PutCorsConfigurationOptions.Builder to create a PutCorsConfigurationOptions object that contains the parameter values for the putCorsConfiguration method.

HTTP request body for putCorsConfiguration.

Examples:
CorsConfiguration

WithContext method only

The PutCorsConfiguration options.

The putCorsConfiguration options.

parameters

  • An array of strings that contain allowed origin domains. You have to specify the full URL including the protocol. It is recommended that only the HTTPS protocol is used. Subdomains count as separate domains, so you have to specify all subdomains used.

  • Boolean value to allow authentication credentials. If set to true, browser requests must be done by using withCredentials = true.

    Default: true

  • Boolean value to turn CORS on and off.

    Default: true

parameters

  • An array of strings that contain allowed origin domains. You have to specify the full URL including the protocol. It is recommended that only the HTTPS protocol is used. Subdomains count as separate domains, so you have to specify all subdomains used.

  • Boolean value to allow authentication credentials. If set to true, browser requests must be done by using withCredentials = true.

    Default: true

  • Boolean value to turn CORS on and off.

    Default: true

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/_api/v2/user/config/cors" -H "Content-Type: application/json" --data '{
      "enable_cors": true,
      "origins": [
        "https://example.com"
      ]
    }'
    
  • putCorsConfigurationOptions := service.NewPutCorsConfigurationOptions([]string{
      "https://example.com",
    })
    putCorsConfigurationOptions.SetEnableCors(true)
    
    ok, response, err := service.PutCorsConfiguration(putCorsConfigurationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(ok, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.CorsConfiguration;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    import com.ibm.cloud.cloudant.v1.model.PutCorsConfigurationOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    CorsConfiguration configuration = new CorsConfiguration.Builder()
        .addOrigins("https://example.com")
        .enableCors(true)
        .build();
    
    PutCorsConfigurationOptions configurationOptions =
        new PutCorsConfigurationOptions.Builder()
            .corsConfiguration(configuration)
            .build();
    
    Ok response =
        service.putCorsConfiguration(configurationOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.putCorsConfiguration({
      enableCors: true,
      origins: ['https://example.com']
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.put_cors_configuration(
      enable_cors=True,
      origins=['https://example.com']
    ).get_result()
    
    print(response)
    

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete a design document attachment

This operation deletes the attachment with filename {attachment_name} of the specified doc. You must supply the rev query parameter or If-Match parameter with the current revision to delete the attachment.

DELETE /{db}/_design/{ddoc}/{attachment_name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.design-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.design-document.write

Rate limit

This operation consumes one write request.

Request

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/products/_design/example/attachment.txt?rev=2-1a0d1cd6f40472509e9aac646183736c"
    

    This example requires the attachment.txt attachment in _design/appliances document to exist. To create the attachment, see Create or modify an attachment.

Response

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve a design document attachment

Returns the file attachment associated with the document. The raw data of the associated attachment is returned (just as if you were accessing a static file). The returned Content-Type is the same as the content type set when the document attachment was submitted to the database.

GET /{db}/_design/{ddoc}/{attachment_name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

  • Header parameter to specify the byte range for a request. This allows the implementation of resumable downloads and skippable streams. This is available for all attachments inside CouchDB.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_design/example/attachment.txt"
    

    This example requires the attachment.txt attachment in _design/appliances document to exist. To create the attachment, see Create or modify an attachment.

Response

Schema for the data in an attachment.

Status Code

  • HTTP response for Attachment.

  • HTTP response for Attachment.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AttachmentContent request and response.

    This appliance includes...
  • Example AttachmentContent request and response.

    This appliance includes...
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for a design document attachment

Returns the HTTP headers that contain a minimal amount of information about the specified attachment. The method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.

HEAD /{db}/_design/{ddoc}/{attachment_name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/products/_design/example/attachment.txt"
    

    This example requires the attachment.txt attachment in _design/appliances document to exist. To create the attachment, see Create or modify an attachment.

Response

Response Headers

  • Header returning the range information for making range requests with application/octet-stream attachments.

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the MD5 digest value of the message body. Can be used for message-integrity check.

  • Response header in the form of bytes <range>/<total content length> returning the bytes requested by the Range header supplied on the request and the total range.

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for Attachment.

  • HTTP response for Attachment.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create or modify a design document attachment

This operation uploads the supplied content as an attachment to the specified document. The attachment name provided must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If the revision is omitted, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

PUT /{db}/_design/{ddoc}/{attachment_name}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.design-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.design-document.write

Rate limit

This operation consumes one write request.

Request

Custom Headers

  • Content-Type of the attachment.

    Allowable values: [*/*]

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

HTTP request body for attachment operations.

Example: This appliance includes...

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/products/_design/example/attachment.txt"  -H "Content-Type: text/plain" --data 'New text attachment'
    

Response

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete an attachment

Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.

Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.

Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.

Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.

Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.

DELETE /{db}/{doc_id}/{attachment_name}
(cloudant *CloudantV1) DeleteAttachment(deleteAttachmentOptions *DeleteAttachmentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteAttachmentWithContext(ctx context.Context, deleteAttachmentOptions *DeleteAttachmentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> deleteAttachment(DeleteAttachmentOptions deleteAttachmentOptions)
deleteAttachment(params)
delete_attachment(
        self,
        db: str,
        doc_id: str,
        attachment_name: str,
        *,
        if_match: Optional[str] = None,
        rev: Optional[str] = None,
        batch: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.data-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.data-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the DeleteAttachmentOptions struct and set the fields to provide parameter values for the DeleteAttachment method.

Use the DeleteAttachmentOptions.Builder to create a DeleteAttachmentOptions object that contains the parameter values for the deleteAttachment method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

WithContext method only

The DeleteAttachment options.

The deleteAttachment options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify a document revision.

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/products/small-appliances:100001/product_details.txt?rev=4-1a0d1cd6f40472509e9aac646183736a"
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • deleteAttachmentOptions := service.NewDeleteAttachmentOptions(
      "products",
      "small-appliances:100001",
      "product_details.txt",
    )
    deleteAttachmentOptions.SetRev("4-1a0d1cd6f40472509e9aac646183736a")
    
    documentResult, response, err := service.DeleteAttachment(deleteAttachmentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteAttachmentOptions;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteAttachmentOptions attachmentOptions =
        new DeleteAttachmentOptions.Builder()
            .db("products")
            .docId("small-appliances:100001")
            .attachmentName("product_details.txt")
            .rev("4-1a0d1cd6f40472509e9aac646183736a")
            .build();
    
    DocumentResult response =
        service.deleteAttachment(attachmentOptions).execute()
            .getResult();
    
    System.out.println(response);
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.deleteAttachment({
      db: 'products',
      docId: 'small-appliances:100001',
      attachmentName: 'product_details.txt',
      rev: '4-1a0d1cd6f40472509e9aac646183736a'
    }).then(response => {
      console.log(response.result);
    });
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_attachment(
      db='products',
      doc_id='small-appliances:100001',
      attachment_name='product_details.txt',
      rev='4-1a0d1cd6f40472509e9aac646183736a'
    ).get_result()
    
    print(response)
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve an attachment

Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.

Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.

Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.

Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.

Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.

GET /{db}/{doc_id}/{attachment_name}
(cloudant *CloudantV1) GetAttachment(getAttachmentOptions *GetAttachmentOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetAttachmentWithContext(ctx context.Context, getAttachmentOptions *GetAttachmentOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)
ServiceCall<InputStream> getAttachment(GetAttachmentOptions getAttachmentOptions)
getAttachment(params)
get_attachment(
        self,
        db: str,
        doc_id: str,
        attachment_name: str,
        *,
        if_match: Optional[str] = None,
        if_none_match: Optional[str] = None,
        range: Optional[str] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetAttachmentOptions struct and set the fields to provide parameter values for the GetAttachment method.

Use the GetAttachmentOptions.Builder to create a GetAttachmentOptions object that contains the parameter values for the getAttachment method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

  • Header parameter to specify the byte range for a request. This allows the implementation of resumable downloads and skippable streams. This is available for all attachments inside CouchDB.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

WithContext method only

The GetAttachment options.

The getAttachment options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • The type of the response: or /.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

  • Header parameter to specify the byte range for a request. This allows the implementation of resumable downloads and skippable streams. This is available for all attachments inside CouchDB.

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

  • Header parameter to specify the byte range for a request. This allows the implementation of resumable downloads and skippable streams. This is available for all attachments inside CouchDB.

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/small-appliances:100001/product_details.txt"
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • getAttachmentOptions := service.NewGetAttachmentOptions(
      "products",
      "small-appliances:100001",
      "product_details.txt",
    )
    
    result, response, err := service.GetAttachment(getAttachmentOptions)
    if err != nil {
      panic(err)
    }
    
    data, _ := ioutil.ReadAll(result)
    fmt.Println("\n", string(data))
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetAttachmentOptions;
    
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.stream.Collectors;
    
    Cloudant service = Cloudant.newInstance();
    
    GetAttachmentOptions attachmentOptions =
        new GetAttachmentOptions.Builder()
            .db("products")
            .docId("small-appliances:100001")
            .attachmentName("product_details.txt")
            .build();
    
    InputStream streamResult =
        service.getAttachment(attachmentOptions).execute()
            .getResult();
    
    String response =
        new BufferedReader(new InputStreamReader(streamResult))
            .lines().collect(Collectors.joining("\n"));
    
    System.out.println(response);
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getAttachment({
      db: 'products',
      docId: 'small-appliances:100001',
      attachmentName: 'product_details.txt'
    }).then(response => {
      let attachment = response.result as Readable;
      attachment.pipe(process.stdout);
    });
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response_attachment = service.get_attachment(
      db='products',
      doc_id='small-appliances:100001',
      attachment_name='product_details.txt'
    ).get_result().content
    
    print(response_attachment)
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

Response

Response type: io.ReadCloser

Response type: InputStream

Response type: NodeJS.ReadableStream

Response type: BinaryIO

Schema for the data in an attachment.

Status Code

  • HTTP response for Attachment.

  • HTTP response for Attachment.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for range not satisfiable.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AttachmentContent request and response.

    This appliance includes...
  • Example AttachmentContent request and response.

    This appliance includes...
  • Example AttachmentContent request and response.

    This appliance includes...
  • Example AttachmentContent request and response.

    This appliance includes...
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for requested range not satisfiable.

    {
      "error": "requested_range_not_satisfiable",
      "reason": "Requested range not satisfiable"
    }
  • Example error response for requested range not satisfiable.

    {
      "error": "requested_range_not_satisfiable",
      "reason": "Requested range not satisfiable"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for an attachment

Returns the HTTP headers that contain a minimal amount of information about the specified attachment. This method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified attachment. This method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified attachment. This method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified attachment. This method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.

Returns the HTTP headers that contain a minimal amount of information about the specified attachment. This method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.

HEAD /{db}/{doc_id}/{attachment_name}
(cloudant *CloudantV1) HeadAttachment(headAttachmentOptions *HeadAttachmentOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadAttachmentWithContext(ctx context.Context, headAttachmentOptions *HeadAttachmentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headAttachment(HeadAttachmentOptions headAttachmentOptions)
headAttachment(params)
head_attachment(
        self,
        db: str,
        doc_id: str,
        attachment_name: str,
        *,
        if_match: Optional[str] = None,
        if_none_match: Optional[str] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the HeadAttachmentOptions struct and set the fields to provide parameter values for the HeadAttachment method.

Use the HeadAttachmentOptions.Builder to create a HeadAttachmentOptions object that contains the parameter values for the headAttachment method.

Custom Headers

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

WithContext method only

The HeadAttachment options.

The headAttachment options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" --head "$SERVICE_URL/products/small-appliances:100001/product_details.txt"
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • headAttachmentOptions := service.NewHeadAttachmentOptions(
      "products",
      "small-appliances:100001",
      "product_details.txt",
    )
    
    response, err := service.HeadAttachment(headAttachmentOptions)
    if err != nil {
      panic(err)
    }
    
    fmt.Println(response.StatusCode)
    fmt.Println(response.Headers["Content-Length"])
    fmt.Println(response.Headers["Content-Type"])
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • import com.ibm.cloud.sdk.core.http.Headers;
    
    import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.HeadAttachmentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    HeadAttachmentOptions attachmentOptions =
        new HeadAttachmentOptions.Builder()
            .db("products")
            .docId("small-appliances:100001")
            .attachmentName("product_details.txt")
            .build();
    
    int statusCode =
        service.headAttachment(attachmentOptions).execute()
            .getStatusCode();
    
    Headers headers =
        service.headAttachment(attachmentOptions).execute()
            .getHeaders();
    
    System.out.println(statusCode);
    System.out.println(headers.values("Content-Length"));
    System.out.println(headers.values("Content-Type"));
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.headAttachment({
      db: 'products',
      docId: 'small-appliances:100001',
      attachmentName: 'product_details.txt'
    }).then(response => {
      console.log(response.status);
      console.log(response.headers['content-length']);
      console.log(response.headers['content-type']);
    });
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.head_attachment(
      db='products',
      doc_id='small-appliances:100001',
      attachment_name='product_details.txt'
    )
    print(response.get_status_code())
    print(response.get_headers()['Content-Length'])
    print(response.get_headers()['Content-Type'])
    

    This example requires the product_details.txt attachment in small-appliances:100001 document to exist. To create the attachment, see Create or modify an attachment.

Response

Response Headers

  • Header returning the range information for making range requests with application/octet-stream attachments.

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the MD5 digest value of the message body. Can be used for message-integrity check.

  • Response header in the form of bytes <range>/<total content length> returning the bytes requested by the Range header supplied on the request and the total range.

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for Attachment.

  • HTTP response for Attachment.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for range not satisfiable.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create or modify an attachment

Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

PUT /{db}/{doc_id}/{attachment_name}
(cloudant *CloudantV1) PutAttachment(putAttachmentOptions *PutAttachmentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutAttachmentWithContext(ctx context.Context, putAttachmentOptions *PutAttachmentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> putAttachment(PutAttachmentOptions putAttachmentOptions)
putAttachment(params)
put_attachment(
        self,
        db: str,
        doc_id: str,
        attachment_name: str,
        attachment: BinaryIO,
        content_type: str,
        *,
        if_match: Optional[str] = None,
        rev: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.data-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.data-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PutAttachmentOptions struct and set the fields to provide parameter values for the PutAttachment method.

Use the PutAttachmentOptions.Builder to create a PutAttachmentOptions object that contains the parameter values for the putAttachment method.

Custom Headers

  • Content-Type of the attachment.

    Allowable values: [*/*]

  • Header parameter to specify the document revision. Alternative to rev query parameter.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression ^[^_].*

Query Parameters

  • Query parameter to specify a document revision.

HTTP request body for attachment operations.

Example: This appliance includes...

WithContext method only

The PutAttachment options.

The putAttachment options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • HTTP request body for attachment operations.

  • Content-Type of the attachment.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify a document revision.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Path parameter to specify the attachment name.

    Possible values: Value must match regular expression /^[^_].*/

  • HTTP request body for attachment operations.

  • Content-Type of the attachment.

  • Header parameter to specify the document revision. Alternative to rev query parameter.

  • Query parameter to specify a document revision.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/products/small-appliances:100001/product_details.txt" -H "Content-Type: text/plain" --data 'This appliance includes...'
    
  • putAttachmentOptions := service.NewPutAttachmentOptions(
      "products",
      "small-appliances:100001",
      "product_details.txt",
      ioutil.NopCloser(
        bytes.NewReader([]byte("This appliance includes...")),
      ),
      "text/plain",
    )
    
    documentResult, response, err := service.PutAttachment(putAttachmentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PutAttachmentOptions;
    
    import java.io.ByteArrayInputStream;
    import java.io.InputStream;
    import java.nio.charset.StandardCharsets;
    
    Cloudant service = Cloudant.newInstance();
    
    String detailedDescription = "This appliance includes...";
    
    InputStream detailedDescriptionStream =
        new ByteArrayInputStream(detailedDescription
            .getBytes(StandardCharsets.UTF_8));
    
    PutAttachmentOptions attachmentOptions =
        new PutAttachmentOptions.Builder()
            .db("products")
            .docId("small-appliances:100001")
            .attachmentName("product_details.txt")
            .attachment(detailedDescriptionStream)
            .contentType("text/plain")
            .build();
    
    DocumentResult response =
        service.putAttachment(attachmentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const stream = new Readable();
    stream.push('This appliance includes...');
    stream.push(null);
    
    service.putAttachment({
      db: 'products',
      docId: 'small-appliances:100001',
      attachmentName: 'product_details.txt',
      attachment: stream,
      contentType: 'text/plain'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    detailed_description = "This appliance includes..."
    response = service.put_attachment(
      db='products',
      doc_id='small-appliances:100001',
      attachment_name='product_details.txt',
      attachment=detailed_description,
      content_type='text/plain'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for conflict.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for a document update conflict.

    {
      "error": "conflict",
      "reason": "Document update conflict."
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Delete a local document

Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.

Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.

Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.

Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.

Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.

DELETE /{db}/_local/{doc_id}
(cloudant *CloudantV1) DeleteLocalDocument(deleteLocalDocumentOptions *DeleteLocalDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) DeleteLocalDocumentWithContext(ctx context.Context, deleteLocalDocumentOptions *DeleteLocalDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> deleteLocalDocument(DeleteLocalDocumentOptions deleteLocalDocumentOptions)
deleteLocalDocument(params)
delete_local_document(
        self,
        db: str,
        doc_id: str,
        *,
        batch: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.local-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.local-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the DeleteLocalDocumentOptions struct and set the fields to provide parameter values for the DeleteLocalDocument method.

Use the DeleteLocalDocumentOptions.Builder to create a DeleteLocalDocumentOptions object that contains the parameter values for the deleteLocalDocument method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

WithContext method only

The DeleteLocalDocument options.

The deleteLocalDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X DELETE "$SERVICE_URL/orders/_local/local-0007741142412418284"
    
  • deleteLocalDocumentOptions := service.NewDeleteLocalDocumentOptions(
      "orders",
      "local-0007741142412418284",
    )
    
    documentResult, response, err := service.DeleteLocalDocument(deleteLocalDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DeleteLocalDocumentOptions;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    
    Cloudant service = Cloudant.newInstance();
    
    DeleteLocalDocumentOptions documentOptions =
        new DeleteLocalDocumentOptions.Builder()
            .db("orders")
            .docId("local-0007741142412418284")
            .build();
    
    DocumentResult response =
        service.deleteLocalDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.deleteLocalDocument({
      db: 'orders',
      docId: 'local-0007741142412418284'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.delete_local_document(
      db='orders',
      doc_id='local-0007741142412418284'
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve a local document

Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.

Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.

Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.

Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.

Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.

GET /{db}/_local/{doc_id}
(cloudant *CloudantV1) GetLocalDocument(getLocalDocumentOptions *GetLocalDocumentOptions) (result *Document, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetLocalDocumentWithContext(ctx context.Context, getLocalDocumentOptions *GetLocalDocumentOptions) (result *Document, response *core.DetailedResponse, err error)
ServiceCall<Document> getLocalDocument(GetLocalDocumentOptions getLocalDocumentOptions)
getLocalDocument(params)
get_local_document(
        self,
        db: str,
        doc_id: str,
        *,
        accept: Optional[str] = None,
        if_none_match: Optional[str] = None,
        attachments: Optional[bool] = None,
        att_encoding_info: Optional[bool] = None,
        local_seq: Optional[bool] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the GetLocalDocumentOptions struct and set the fields to provide parameter values for the GetLocalDocument method.

Use the GetLocalDocumentOptions.Builder to create a GetLocalDocumentOptions object that contains the parameter values for the getLocalDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

  • Allowable values: [application/json,multipart/mixed,multipart/related]

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include attachments only since specified revisions. Note this does not include the attachments for the specified revisions.

    Examples:
    View
  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

WithContext method only

The GetLocalDocument options.

The getLocalDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • The type of the response: application/json, multipart/mixed, multipart/related, or application/octet-stream.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

    Default: application/json

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • The type of the response: application/json, multipart/mixed, multipart/related, or application/octet-stream.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

    Default: application/json

  • Header parameter to specify a double quoted document revision token for cache control.

  • Query parameter to specify whether to include attachments bodies in a response.

    Default: false

  • Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

    Default: false

  • Query parameter to specify whether to include the last update sequence for the document.

    Default: false

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/orders/_local/local-0007741142412418284"
    
  • getLocalDocumentOptions := service.NewGetLocalDocumentOptions(
      "orders",
      "local-0007741142412418284",
    )
    
    document, response, err := service.GetLocalDocument(getLocalDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(document, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.GetLocalDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    GetLocalDocumentOptions documentOptions =
        new GetLocalDocumentOptions.Builder()
            .db("orders")
            .docId("local-0007741142412418284")
            .build();
    
    Document response =
        service.getLocalDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getLocalDocument({
      db: 'orders',
      docId: 'local-0007741142412418284'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_local_document(
      db='orders',
      doc_id='local-0007741142412418284'
    ).get_result()
    
    print(response)
    

Response

Schema for a document.

Schema for a document.

Schema for a document.

Schema for a document.

Schema for a document.

Status Code

  • HTTP response for Document.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Document.

    {
      "_id": "exampleid",
      "brand": "Foo",
      "colours": [
        "red",
        "green",
        "black",
        "blue"
      ],
      "description": "Slim Colourful Design Electronic Cooking Appliance for ...",
      "image": "assets/img/0gmsnghhew.jpg",
      "keywords": [
        "Foo",
        "Scales",
        "Weight",
        "Digital",
        "Kitchen"
      ],
      "name": "Digital Kitchen Scales",
      "price": 14.99,
      "productid": "1000042",
      "taxonomy": [
        "Home",
        "Kitchen",
        "Small Appliances"
      ],
      "type": "product"
    }
  • Example Document.

    {
      "_id": "exampleid",
      "brand": "Foo",
      "colours": [
        "red",
        "green",
        "black",
        "blue"
      ],
      "description": "Slim Colourful Design Electronic Cooking Appliance for ...",
      "image": "assets/img/0gmsnghhew.jpg",
      "keywords": [
        "Foo",
        "Scales",
        "Weight",
        "Digital",
        "Kitchen"
      ],
      "name": "Digital Kitchen Scales",
      "price": 14.99,
      "productid": "1000042",
      "taxonomy": [
        "Home",
        "Kitchen",
        "Small Appliances"
      ],
      "type": "product"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a local document

Retrieves the HTTP headers containing minimal amount of information about the specified local document. Since the response body is empty, using the HEAD method is a lightweight way to check if the local document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified local document. Since the response body is empty, using the HEAD method is a lightweight way to check if the local document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified local document. Since the response body is empty, using the HEAD method is a lightweight way to check if the local document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified local document. Since the response body is empty, using the HEAD method is a lightweight way to check if the local document exists or not.

Retrieves the HTTP headers containing minimal amount of information about the specified local document. Since the response body is empty, using the HEAD method is a lightweight way to check if the local document exists or not.

HEAD /{db}/_local/{doc_id}
(cloudant *CloudantV1) HeadLocalDocument(headLocalDocumentOptions *HeadLocalDocumentOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadLocalDocumentWithContext(ctx context.Context, headLocalDocumentOptions *HeadLocalDocumentOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headLocalDocument(HeadLocalDocumentOptions headLocalDocumentOptions)
headLocalDocument(params)
head_local_document(
        self,
        db: str,
        doc_id: str,
        *,
        if_none_match: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Rate limit

This operation consumes one read request.

Request

Instantiate the HeadLocalDocumentOptions struct and set the fields to provide parameter values for the HeadLocalDocument method.

Use the HeadLocalDocumentOptions.Builder to create a HeadLocalDocumentOptions object that contains the parameter values for the headLocalDocument method.

Custom Headers

  • Header parameter to specify a double quoted document revision token for cache control.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The HeadLocalDocument options.

The headLocalDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Header parameter to specify a double quoted document revision token for cache control.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the double quoted base64 encoded MD5 binary digest.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for Document.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Create or modify a local document

Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.

Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.

Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.

Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.

Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.

PUT /{db}/_local/{doc_id}
(cloudant *CloudantV1) PutLocalDocument(putLocalDocumentOptions *PutLocalDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PutLocalDocumentWithContext(ctx context.Context, putLocalDocumentOptions *PutLocalDocumentOptions) (result *DocumentResult, response *core.DetailedResponse, err error)
ServiceCall<DocumentResult> putLocalDocument(PutLocalDocumentOptions putLocalDocumentOptions)
putLocalDocument(params)
put_local_document(
        self,
        db: str,
        doc_id: str,
        document: Union['Document', BinaryIO],
        *,
        content_type: Optional[str] = None,
        batch: Optional[str] = None,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.local-document.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.local-document.write

Rate limit

This operation consumes one write request.

Request

Instantiate the PutLocalDocumentOptions struct and set the fields to provide parameter values for the PutLocalDocument method.

Use the PutLocalDocumentOptions.Builder to create a PutLocalDocumentOptions object that contains the parameter values for the putLocalDocument method.

Custom Headers

  • Allowable values: [application/json,multipart/mixed,multipart/related]

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Query Parameters

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

HTTP request body for Document operations.

Examples:
Document

WithContext method only

The PutLocalDocument options.

The putLocalDocument options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • HTTP request body for Document operations.

  • The type of the input.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • Schema for a document.

  • The type of the input.

    Allowable values: [application/json,multipart/mixed,multipart/related,application/octet-stream]

  • Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.

    Allowable values: [ok]

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X PUT "$SERVICE_URL/orders/_local/local-0007741142412418284" -H "Content-Type: application/json" --data '{
      "type": "order",
      "user": "Bob Smith",
      "orderid": "0007741142412418284",
      "userid": "abc123",
      "basket": [
        {
          "name": "Salter - Digital Kitchen Scales",
          "price": 14.99
        },
        {
          "name": "Kenwood - Stand Mixer",
          "price": 199.99
        }
      ],
      "total": 214.98,
      "deliveryAddress": "19 Front Street, Darlington, DL5 1TY",
      "delivered": "true",
      "courier": "UPS",
      "courierid": "15125425151261289",
      "date": "2019-01-28T10:44:22.000Z"
    }'
    
  • localDocument := cloudantv1.Document{}
    properties := map[string]interface{}{
      "type":            "order",
      "user":            "Bob Smith",
      "orderid":         "0007741142412418284",
      "userid":          "abc123",
      "total":           214.98,
      "deliveryAddress": "19 Front Street, Darlington, DL5 1TY",
      "delivered":       true,
      "courier":         "UPS",
      "courierid":       "15125425151261289",
      "date":            "2019-01-28T10:44:22.000Z",
    }
    for key, value := range properties {
      localDocument.SetProperty(key, value)
    }
    
    putLocalDocumentOptions := service.NewPutLocalDocumentOptions(
      "orders",
      "local-0007741142412418284",
    )
    putLocalDocumentOptions.SetDocument(&localDocument)
    
    documentResult, response, err := service.PutLocalDocument(putLocalDocumentOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentResult, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Document;
    import com.ibm.cloud.cloudant.v1.model.DocumentResult;
    import com.ibm.cloud.cloudant.v1.model.PutLocalDocumentOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    Document orderDocument = new Document();
    orderDocument.put("type", "order");
    orderDocument.put("user", "Bob Smith");
    orderDocument.put("orderid", "0007741142412418284");
    orderDocument.put("userid", "abc123");
    orderDocument.put("total", 214.98);
    orderDocument.put("deliveryAddress", "19 Front Street, Darlington, DL5 1TY");
    orderDocument.put("delivered", true);
    orderDocument.put("courier", "UPS");
    orderDocument.put("courierid", "15125425151261289");
    orderDocument.put("date", "2019-01-28T10:44:22.000Z");
    
    PutLocalDocumentOptions documentOptions =
        new PutLocalDocumentOptions.Builder()
            .db("orders")
            .docId("local-0007741142412418284")
            .document(orderDocument)
            .build();
    
    DocumentResult response =
        service.putLocalDocument(documentOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const localDocument: CloudantV1.Document = {
      type: 'order',
      user: 'Bob Smith',
      orderid: '0007741142412418284',
      userid: 'abc123',
      total: 214.98,
      deliveryAddress: '19 Front Street, Darlington, DL5 1TY',
      delivered: 'true',
      courier: 'UPS',
      courierid: '15125425151261289',
      date: '2019-01-28T10:44:22.000Z'
    }
    
    service.putLocalDocument({
      db: 'orders',
      docId: 'local-0007741142412418284',
      document: localDocument
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import Document, CloudantV1
    
    service = CloudantV1.new_instance()
    
    local_document = Document(
       type='order',
       user='Bob Smith',
       orderid='0007741142412418284',
       userid='abc123',
       total=214.98,
       deliveryAddress='19 Front Street, Darlington, DL5 1TY',
       delivered='true',
       courier='UPS',
       courierid='15125425151261289',
       date='2019-01-28T10:44:22.000Z'
    )
    
    response = service.put_local_document(
      db='orders',
      doc_id='local-0007741142412418284',
      document=local_document,
    ).get_result()
    
    print(response)
    

Response

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Schema for the result of a document modification.

Status Code

  • HTTP response for Document modification operations.

  • HTTP response for Document modification operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for precondition failed.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example DocumentResult for a creation.

    {
      "id": "exampleid",
      "ok": true,
      "rev": "2-056f5f44046ecafc08a2bc2b9c229e20"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a database already existing.

    {
      "error": "file_exists",
      "reason": "The database could not be created, the file already exists."
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query a list of all local documents in a database (GET)

Queries the list of all local document IDs. The results matching the query parameters are returned in a JSON object, including a list of matching local documents with basic contents, such as the ID. When no query parameters are specified, results for all local documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

GET /{db}/_local_docs

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Query Parameters

  • Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

    Default: false

  • Query parameter to specify whether to return the documents in descending by key order.

    Default: false

  • Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to stop returning records when the specified document ID is reached.

  • Query parameter to specify whether to include the full content of the documents in the response.

    Default: false

  • Query parameter to specify whether the specified end key should be included in the result.

    Default: true

  • Query parameter to specify to return only documents that match the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify the number of returned documents to limit the result to.

    Possible values: value ≥ 0

  • Query parameter to specify the number of records before starting to return the results.

    Possible values: value ≥ 0

    Default: 0

  • Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.

  • Query parameter to specify to start returning records from the specified document ID.

  • Query parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.

    Default: false

Response

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for a list of all local documents in a database (GET)

Retrieves the HTTP headers for a list of all local documents in a database (GET).

HEAD /{db}/_local_docs

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Query a list of all local documents in a database

Queries the list of all local document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching local documents with basic contents, such as the ID. When no request body parameters are specified, results for all local documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

POST /{db}/_local_docs

Rate limit

This operation consumes one global query request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for postAllDocs and postPartitionAllDocs.

Examples:
AllDocsQuery

Response

Schema for the result of an all documents operation.

Status Code

  • HTTP response for /_all_docs style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsResult response.

    {
      "offset": 0,
      "rows": [
        {
          "doc": {
            "_id": "exampleid",
            "_rev": "1-967a00dff5e02add41819138abb3284d"
          },
          "id": "exampleid",
          "key": "exampleid",
          "value": {
            "rev": "1-967a00dff5e02add41819138abb3284d"
          }
        }
      ],
      "total_rows": 1
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Multi-query the list of all local documents in a database

Runs multiple view queries of all local documents in this database. This operation enables you to request multiple queries in a single request, in place of multiple POST /{db}/_local_docs requests.

POST /{db}/_local_docs/queries

Rate limit

This operation consumes one global query per query in the request.

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for allDocsQueriesQuery, designDocsQueriesQuery and localDocsQueriesQuery.

Examples:
AllDocsQueriesQuery

Response

Schema for the result of an all documents queries operation.

Status Code

  • HTTP response for /_all_docs/queries style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example AllDocsQueriesResult response.

    {
      "results": [
        {
          "offset": null,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        },
        {
          "offset": 2,
          "rows": [
            {
              "id": "exampleid",
              "key": "exampleid",
              "value": {
                "rev": "1-5005d65514fe9e90f8eccf174af5dd64"
              }
            },
            {
              "id": "exampleid2",
              "key": "exampleid2",
              "value": {
                "rev": "1-2d7810b054babeda4812b3924428d6d6"
              }
            }
          ],
          "total_rows": 5
        }
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Commit any recent changes to the specified database to disk

Commits any recent changes to the specified database to disk. You must make a request to this endpoint if you want to ensure that recent changes have been flushed. This function is likely not required, assuming you have the recommended configuration setting, delayed_commits=false. This setting requires that changes are written to disk before a 200 or similar result is returned.

POST /{db}/_ensure_full_commit

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-ensure-full-commit.execute

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-ensure-full-commit.execute

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Schema for the status of a commit operation.

Status Code

  • HTTP response for postEnsureFullCommit.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example EnsureFullCommitInformation response.

    {
      "instance_start_time": "0",
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query which document revisions are missing from the database

Given a list of document revisions, returns the document revisions that do not exist in the database.

POST /{db}/_missing_revs

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for operations with Document revisions.

Examples:
DocumentRevisions
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/events/_missing_revs" -H "Content-Type: application/json" --data '{
      "order00077": [
        "1-abcdefg",
        "2-hijklmn"
      ]
    }'
    

    This example requires the example revisions in the POST body to be replaced with valid revisions.

  • postMissingRevsOptions := service.NewPostMissingRevsOptions(
      "orders",
      map[string][]string{
        "order00077": {"<order00077-existing-revision>", "<2-missing-revision>"},
      },
    )
    
    missingRevsResult, response, err := service.PostMissingRevs(postMissingRevsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(missingRevsResult, "", "  ")
    fmt.Println(string(b))
    

    This example requires the example revisions in the POST body to be replaced with valid revisions.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DocumentRevisions;
    import com.ibm.cloud.cloudant.v1.model.MissingRevsResult;
    import com.ibm.cloud.cloudant.v1.model.PostMissingRevsOptions;
    
    import java.util.Arrays;
    
    Cloudant service = Cloudant.newInstance();
    
    DocumentRevisions revs = new DocumentRevisions();
    revs.put(
      "order00077",
      Arrays.asList("<order00077-existing-revision>", "<2-missing-revision>")
    );
    
    PostMissingRevsOptions missingRevsOptions =
        new PostMissingRevsOptions.Builder()
            .db("orders")
            .missingRevs(revs)
            .build();
    
    MissingRevsResult response =
        service.postMissingRevs(missingRevsOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const revs: CloudantV1.DocumentRevisions = {
      order00077: ['<order00077-existing-revision>', '<2-missing-revision>']
    };
    
    service.postMissingRevs({
      db: 'orders',
      missingRevs: revs
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import DocumentRevisions, CloudantV1
    
    service = CloudantV1.new_instance()
    
    revs = DocumentRevisions(order00077=['<order00077-existing-revision>', '<2-missing-revision>'])
    response = service.post_missing_revs(
      db='orders',
      missing_revs=revs.to_dict()
    ).get_result()
    
    print(response)
    

Response

Schema for mapping document IDs to lists of missing revisions.

Status Code

  • HTTP response for postMissingRevs.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example MissingRevsResult response.

    {
      "missing_revs": {
        "order00077": [
          "2-b06fcd1c1c9e0ec7c480ee8aa467bf3b"
        ]
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query the document revisions and possible ancestors missing from the database

The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exists there. It can then avoid fetching and sending already-known document bodies.

The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exists there. It can then avoid fetching and sending already-known document bodies.

The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exists there. It can then avoid fetching and sending already-known document bodies.

The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exists there. It can then avoid fetching and sending already-known document bodies.

The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database's _revs_diff to find out which of them already exists there. It can then avoid fetching and sending already-known document bodies.

POST /{db}/_revs_diff
(cloudant *CloudantV1) PostRevsDiff(postRevsDiffOptions *PostRevsDiffOptions) (result map[string]RevsDiff, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostRevsDiffWithContext(ctx context.Context, postRevsDiffOptions *PostRevsDiffOptions) (result map[string]RevsDiff, response *core.DetailedResponse, err error)
ServiceCall<Map<String, RevsDiff>> postRevsDiff(PostRevsDiffOptions postRevsDiffOptions)
postRevsDiff(params)
post_revs_diff(
        self,
        db: str,
        document_revisions: dict,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.any-document.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.any-document.read

Request

Instantiate the PostRevsDiffOptions struct and set the fields to provide parameter values for the PostRevsDiff method.

Use the PostRevsDiffOptions.Builder to create a PostRevsDiffOptions object that contains the parameter values for the postRevsDiff method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for operations with Document revisions.

Examples:
DocumentRevisions

WithContext method only

The PostRevsDiff options.

The postRevsDiff options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • HTTP request body for operations with Document revisions.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • HTTP request body for operations with Document revisions.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/orders/_revs_diff" -H "Content-Type: application/json" -d '{
      "order00077": [
        "1-abcdefg",
        "2-hijklmn",
        "3-opqrstu"
      ]
    }'
    

    This example requires the example revisions in the POST body to be replaced with valid revisions.

  • postRevsDiffOptions := service.NewPostRevsDiffOptions(
      "orders",
      map[string][]string{
        "order00077": {
          "<1-missing-revision>",
          "<2-missing-revision>",
          "<3-possible-ancestor-revision>",
        },
      },
    )
    
    mapStringRevsDiff, response, err := service.PostRevsDiff(postRevsDiffOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(mapStringRevsDiff, "", "  ")
    fmt.Println(string(b))
    

    This example requires the example revisions in the POST body to be replaced with valid revisions.

  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DocumentRevisions;
    import com.ibm.cloud.cloudant.v1.model.PostRevsDiffOptions;
    import com.ibm.cloud.cloudant.v1.model.RevsDiffResult;
    
    Cloudant service = Cloudant.newInstance();
    
    DocumentRevisions revsDiff = new DocumentRevisions();
    revsDiff.put("order00077", Arrays.asList("<1-missing-revision>",
      "<2-missing-revision>", "<3-possible-ancestor-revision>"));
    
    PostRevsDiffOptions revsDiffOptions =
        new PostRevsDiffOptions.Builder()
            .db("orders")
            .revsDiffRequest(revsDiff)
            .build();
    
    RevsDiffResult response =
        service.postRevsDiff(revsDiffOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    const revsDiff: CloudantV1.DocumentRevisions = {
      order00077: [
        "<1-missing-revision>",
        "<2-missing-revision>",
        "<3-possible-ancestor-revision>"
      ]
    }
    
    service.postRevsDiff({
      db: 'orders',
      revsDiffRequest: revsDiff
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import DocumentRevisions, CloudantV1
    
    service = CloudantV1.new_instance()
    
    revs_diff = DocumentRevisions(
      order00077=[
          "<1-missing-revision>",
          "<2-missing-revision>",
          "<3-possible-ancestor-revision>"
    ]
    )
    
    response = service.post_revs_diff(
      db='orders',
      revs_diff_request=revs_diff.to_dict()
    ).get_result()
    
    print(response)
    

Response

Response type: map[string]RevsDiff

Response type: Map<String, RevsDiff>

Response type: JsonObject

Response type: dict

Schema for mapping document IDs to RevsDiff information.

Status Code

  • HTTP response for postRevsDiff.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example RevsDiffResult response.

    {
      "order00077": {
        "missing": [
          "3-bb72a7682290f94a985f7afac8b27137,",
          "5-067a00dff5e02add41819138abb3284d"
        ],
        "possible_ancestors": [
          "4-10265e5a26d807a3cfa459cf1a82ef2e"
        ]
      }
    }
  • Example RevsDiffResult response.

    {
      "order00077": {
        "missing": [
          "3-bb72a7682290f94a985f7afac8b27137,",
          "5-067a00dff5e02add41819138abb3284d"
        ],
        "possible_ancestors": [
          "4-10265e5a26d807a3cfa459cf1a82ef2e"
        ]
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the current revision limit

GET /{db}/_revs_limit

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-revs-limit.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Schema for the revision limit.

Status Code

  • HTTP response for /{db}/_revs_limit style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example RevsLimit response.

    1000
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers of the current revision limit

HEAD /{db}/_revs_limit

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-revs-limit.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_revs_limit style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Set the revision limit

Sets the maximum number of document revisions tracked, even after compaction occurs. You can set the revision limit on a database with a scalar integer for the limit that you want to set as the request body.

PUT /{db}/_revs_limit

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-revs-limit.write

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

HTTP request body for putRevsLimit.

Example: 1000

Response

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve shard information

List each shard range and the corresponding replicas for a specified database.

List each shard range and the corresponding replicas for a specified database.

List each shard range and the corresponding replicas for a specified database.

List each shard range and the corresponding replicas for a specified database.

List each shard range and the corresponding replicas for a specified database.

GET /{db}/_shards
(cloudant *CloudantV1) GetShardsInformation(getShardsInformationOptions *GetShardsInformationOptions) (result *ShardsInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetShardsInformationWithContext(ctx context.Context, getShardsInformationOptions *GetShardsInformationOptions) (result *ShardsInformation, response *core.DetailedResponse, err error)
ServiceCall<ShardsInformation> getShardsInformation(GetShardsInformationOptions getShardsInformationOptions)
getShardsInformation(params)
get_shards_information(
        self,
        db: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-shards.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-shards.read

Request

Instantiate the GetShardsInformationOptions struct and set the fields to provide parameter values for the GetShardsInformation method.

Use the GetShardsInformationOptions.Builder to create a GetShardsInformationOptions object that contains the parameter values for the getShardsInformation method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

WithContext method only

The GetShardsInformation options.

The getShardsInformation options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_shards"
    
  • getShardsInformationOptions := service.NewGetShardsInformationOptions(
      "products",
    )
    
    shardsInformation, response, err := service.GetShardsInformation(getShardsInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(shardsInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.GetShardsInformationOptions;
    import com.ibm.cloud.cloudant.v1.model.ShardsInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    GetShardsInformationOptions shardsInformationOptions =
        new GetShardsInformationOptions.Builder()
            .db("products")
            .build();
    
    ShardsInformation response =
        service.getShardsInformation(shardsInformationOptions)
            .execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getShardsInformation({
      db: 'products'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_shards_information(
      db='products'
    ).get_result()
    
    print(response)
    

Response

Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of that shard.

Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of that shard.

Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of that shard.

Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of that shard.

Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of that shard.

Status Code

  • HTTP response for /{db}/_shards style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ShardsInformation response.

    {
      "shards": {
        "00000000-3fffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ],
        "40000000-7fffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ],
        "80000000-bfffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ],
        "c0000000-ffffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ]
      }
    }
  • Example ShardsInformation response.

    {
      "shards": {
        "00000000-3fffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ],
        "40000000-7fffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ],
        "80000000-bfffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ],
        "c0000000-ffffffff": [
          "node1@xxx.xxx.xxx.xxx",
          "node2@xxx.xxx.xxx.xxx",
          "node3@xxx.xxx.xxx.xxx"
        ]
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for shard information

Retrieves the HTTP headers for shard information.

HEAD /{db}/_shards

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-shards.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-shards.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_shards style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve shard information for a specific document

Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.

Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.

Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.

Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.

Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.

GET /{db}/_shards/{doc_id}
(cloudant *CloudantV1) GetDocumentShardsInfo(getDocumentShardsInfoOptions *GetDocumentShardsInfoOptions) (result *DocumentShardInfo, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetDocumentShardsInfoWithContext(ctx context.Context, getDocumentShardsInfoOptions *GetDocumentShardsInfoOptions) (result *DocumentShardInfo, response *core.DetailedResponse, err error)
ServiceCall<DocumentShardInfo> getDocumentShardsInfo(GetDocumentShardsInfoOptions getDocumentShardsInfoOptions)
getDocumentShardsInfo(params)
get_document_shards_info(
        self,
        db: str,
        doc_id: str,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-shards.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-shards.read

Request

Instantiate the GetDocumentShardsInfoOptions struct and set the fields to provide parameter values for the GetDocumentShardsInfo method.

Use the GetDocumentShardsInfoOptions.Builder to create a GetDocumentShardsInfoOptions object that contains the parameter values for the getDocumentShardsInfo method.

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

WithContext method only

The GetDocumentShardsInfo options.

The getDocumentShardsInfo options.

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression /^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+\/-]*$/

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression /^[^_].+/

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/products/_shards/small-appliances:1000042"
    
  • getDocumentShardsInfoOptions := service.NewGetDocumentShardsInfoOptions(
      "products",
      "small-appliances:1000042",
    )
    
    documentShardInfo, response, err := service.GetDocumentShardsInfo(getDocumentShardsInfoOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(documentShardInfo, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.DocumentShardInfo;
    import com.ibm.cloud.cloudant.v1.model.GetDocumentShardsInfoOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    GetDocumentShardsInfoOptions shardsInfoOptions =
        new GetDocumentShardsInfoOptions.Builder()
            .db("products")
            .docId("small-appliances:1000042")
            .build();
    
    DocumentShardInfo response =
        service.getDocumentShardsInfo(shardsInfoOptions).execute()
            .getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getDocumentShardsInfo({
      db: 'products',
      docId: 'small-appliances:1000042'
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_document_shards_info(
      db='products',
      doc_id='small-appliances:1000042'
    ).get_result()
    
    print(response)
    

Response

Schema for document shard information.

Schema for document shard information.

Schema for document shard information.

Schema for document shard information.

Schema for document shard information.

Status Code

  • HTTP response for /{db}/_shards/{doc_id} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example document shard information response.

    {
      "nodes": [
        "dbcore@db1.example",
        "dbcore@db2.example",
        "dbcore@db3.example"
      ],
      "range": "d0000000-dfffffff"
    }
  • Example document shard information response.

    {
      "nodes": [
        "dbcore@db1.example",
        "dbcore@db2.example",
        "dbcore@db3.example"
      ],
      "range": "d0000000-dfffffff"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers on shard information for a specific document

Retrieves the HTTP headers for the shard information of a specific document. Since the response body is empty, using the HEAD method is a lightweight way to check if the specific shard exists or not.

HEAD /{db}/_shards/{doc_id}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.database-shards.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.database-shards.read

Request

Path Parameters

  • Path parameter to specify the database name.

    Possible values: length ≤ 238, Value must match regular expression ^_dbs$|^_global_changes$|^_metadata$|^_nodes$|^_replicator$|^_users$| ^[a-z][a-z0-9_$()+/-]*$

  • Path parameter to specify the document ID.

    Possible values: Value must match regular expression ^[^_].+

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /{db}/_shards/{doc_id} style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve list of running tasks

Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.

Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.

Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.

Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.

Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.

GET /_active_tasks
(cloudant *CloudantV1) GetActiveTasks(getActiveTasksOptions *GetActiveTasksOptions) (result []ActiveTask, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetActiveTasksWithContext(ctx context.Context, getActiveTasksOptions *GetActiveTasksOptions) (result []ActiveTask, response *core.DetailedResponse, err error)
ServiceCall<List<ActiveTask>> getActiveTasks()
getActiveTasks(params)
get_active_tasks(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-active-tasks.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-active-tasks.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_active_tasks"
    
  • getActiveTasksOptions := service.NewGetActiveTasksOptions()
    
    activeTask, response, err := service.GetActiveTasks(getActiveTasksOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(activeTask, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ActiveTask;
    
    Cloudant service = Cloudant.newInstance();
    
    List<ActiveTask> response =
        service.getActiveTasks().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getActiveTasks().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_active_tasks().get_result()
    
    print(response)
    

Response

Response type: []ActiveTask

Response type: List<ActiveTask>

Response type: ActiveTask[]

Response type: List[ActiveTask]

Schema for a list of ActiveTask elements.

Status Code

  • HTTP response for /_active_tasks style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ActiveTasks response.

    [
      {
        "changes_done": 64438,
        "database": "products",
        "node": "nonode@nohost",
        "pid": "<0.12986.1>",
        "progress": 84,
        "started_on": 1376116576,
        "total_changes": 76215,
        "type": "database_compaction",
        "updated_on": 1376116619
      },
      {
        "changes_done": 14443,
        "database": "users",
        "design_document": "c9753817b3ba7c674d92361f24f59b9f",
        "node": "nonode@nohost",
        "pid": "<0.10461.3>",
        "progress": 18,
        "started_on": 1376116621,
        "total_changes": 76215,
        "type": "indexer",
        "updated_on": 1376116650
      }
    ]
  • Example ActiveTasks response.

    [
      {
        "changes_done": 64438,
        "database": "products",
        "node": "nonode@nohost",
        "pid": "<0.12986.1>",
        "progress": 84,
        "started_on": 1376116576,
        "total_changes": 76215,
        "type": "database_compaction",
        "updated_on": 1376116619
      },
      {
        "changes_done": 14443,
        "database": "users",
        "design_document": "c9753817b3ba7c674d92361f24f59b9f",
        "node": "nonode@nohost",
        "pid": "<0.10461.3>",
        "progress": 18,
        "started_on": 1376116621,
        "total_changes": 76215,
        "type": "indexer",
        "updated_on": 1376116650
      }
    ]
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the HTTP headers for running tasks

Retrieves the HTTP headers for running tasks.

HEAD /_active_tasks

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-active-tasks.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-active-tasks.read

Request

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_active_tasks style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve running server statistics

Returns a JSON object that contains the statistics for the running server. The object is structured with top-level sections collating the statistics for a range of entries, with each individual statistic being easily identified. The content of each statistic is self-describing. The literal string, _local, serves as an alias for the local node name. For any URL, {node-name}/_stats can be replaced with _local/_stats to interact with the local node's statistics.

GET /_node/{node_name}/_stats

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.node-stats.read

Request

Path Parameters

  • Path parameter to specify the node name.

Response

Schema for node statistics.

Status Code

  • HTTP response for /_node/{node_name}/_stats style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example NodeStatsInformation response.

    {
      "couch_log": "...",
      "couch_replicator": "...",
      "couchdb": "...",
      "dbcopy": "...",
      "dreyfus": "...",
      "fabric": "...",
      "global_changes": {
        "db_writes": {
          "desc": "number of db writes performed by global changes",
          "type": "counter",
          "value": 95100
        },
        "event_doc_conflict": {
          "desc": "number of conflicted event docs encountered by global changes",
          "type": "counter",
          "value": 0
        },
        "listener_pending_updates": {
          "desc": "number of global changes updates pending writes in global_changes_listener",
          "type": "gauge",
          "value": 0
        },
        "rpcs": {
          "desc": "number of rpc operations performed by global_changes",
          "type": "counter",
          "value": 340161
        },
        "server_pending_updates": {
          "desc": "number of global changes updates pending writes in global_changes_server",
          "type": "gauge",
          "value": 0
        }
      },
      "mango": {
        "docs_examined": {
          "desc": "number of documents examined by mango queries coordinated by this node",
          "type": "counter",
          "value": 0
        },
        "evaluate_selector": {
          "desc": "number of mango selector evaluations",
          "type": "counter",
          "value": 0
        },
        "query_invalid_index": {
          "desc": "number of mango queries that generated an invalid index warning",
          "type": "counter",
          "value": 0
        },
        "query_time": {
          "desc": "length of time processing a mango query",
          "type": "histogram",
          "value": "..."
        },
        "quorum_docs_examined": {
          "desc": "number of documents examined by mango queries, using cluster quorum",
          "type": "counter",
          "value": 0
        },
        "results_returned": {
          "desc": "number of rows returned by mango queries",
          "type": "counter",
          "value": 0
        },
        "too_many_docs_scanned": {
          "desc": "number of mango queries that generated an index scan warning",
          "type": "counter",
          "value": 0
        },
        "unindexed_queries": {
          "desc": "number of mango queries that could not use an index",
          "type": "counter",
          "value": 0
        }
      },
      "mem3": {
        "shard_cache": {
          "eviction": {
            "desc": "number of shard cache evictions",
            "type": "counter",
            "value": 58040
          },
          "hit": {
            "desc": "number of shard cache hits",
            "type": "counter",
            "value": 209241424
          },
          "miss": {
            "desc": "number of shard cache misses",
            "type": "counter",
            "value": 105016
          }
        }
      },
      "pread": "...",
      "rexi": "..."
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for running server statistics

Retrieves the HTTP headers for running server statistics.

HEAD /_node/{node_name}/_stats

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.node-stats.read

Request

Path Parameters

  • Path parameter to specify the node name.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_node/{node_name}/_stats style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve system-level statistics for the running server

Returns a JSON object that contains various system-level statistics for the running server. The object is structured with top-level sections that collate the statistics for a range of entries, with each individual statistic being easily identified. The content of each statistic is self-describing. The literal string, _local, serves as an alias for the local node name. For any URL, {node-name}/_stats can be replaced with _local/_stats to interact with the local node's statistics.

GET /_node/{node_name}/_system

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.node-system.read

Request

Path Parameters

  • Path parameter to specify the node name.

Response

Schema for system-level statistics for the running server.

Status Code

  • HTTP response for /_node/{node_name}/_system style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example NodeSystemInformation response.

    {
      "context_switches": 8438297853,
      "distribution": {
        "clouseau@127.0.0.1": {
          "recv_avg": 59,
          "recv_cnt": 201145,
          "recv_dvi": 3,
          "recv_max": 1092,
          "recv_oct": 11915505,
          "send_avg": 150,
          "send_cnt": 517599,
          "send_max": 645,
          "send_oct": 78061898,
          "send_pend": 0
        },
        "node2@xxx.xxx.xxx.xxx": {
          "recv_avg": 2368,
          "recv_cnt": 153463822,
          "recv_dvi": 47,
          "recv_max": 3829916,
          "recv_oct": 363548809101,
          "send_avg": 2538,
          "send_cnt": 141966830,
          "send_max": 3829916,
          "send_oct": 360332607798,
          "send_pend": 0
        },
        "node3@xxx.xxx.xxx.xxx": {
          "recv_avg": 2497,
          "recv_cnt": 167533127,
          "recv_dvi": 37,
          "recv_max": 3829916,
          "recv_oct": 418337019652,
          "send_avg": 2444,
          "send_cnt": 170492552,
          "send_max": 3829916,
          "send_oct": 416685906514,
          "send_pend": 0
        }
      },
      "ets_table_count": 142,
      "garbage_collection_count": 1937892400,
      "internal_replication_jobs": 0,
      "io_input": 2682684187851,
      "io_output": 2063758901208,
      "memory": {
        "atom": 744345,
        "atom_used": 735380,
        "binary": 14997320,
        "code": 17273588,
        "ets": 4763680,
        "other": 47875443,
        "processes": 73595384,
        "processes_used": 73594040
      },
      "message_queues": {
        "alarm_handler": 0,
        "application_controller": 0,
        "auth": 0,
        "bacon_dv": 0,
        "bacon_server": 0,
        "bacon_sup": 0,
        "bcrypt_sup": 0,
        "cassim_metadata_cache": 0,
        "cassim_sup": 0,
        "chttpd": 0,
        "chttpd_auth_cache_lru": 0,
        "chttpd_sup": 0,
        "cloudant_auth_cache": 0,
        "code_server": 0,
        "config": 0,
        "config_event": 0,
        "config_sup": 0,
        "couch_audit_server": 0,
        "couch_audit_sup": 0,
        "couch_audit_tcp": 0,
        "couch_auth_cache": 0,
        "couch_db_updater": {
          "50": 0,
          "90": 0,
          "99": 0,
          "count": 40,
          "max": 0,
          "min": 0
        },
        "couch_drv": 0,
        "couch_epi_functions_gen_chttpd": 0,
        "couch_epi_functions_gen_chttpd_auth": 0,
        "couch_epi_functions_gen_chttpd_handlers": 0,
        "couch_epi_functions_gen_couch_db": 0,
        "couch_epi_functions_gen_couch_index": 0,
        "couch_epi_functions_gen_global_changes": 0,
        "couch_epi_sup": 0,
        "couch_event_server": 0,
        "couch_event_sup2": 0,
        "couch_external_manager": 0,
        "couch_file": {
          "50": 0,
          "90": 0,
          "99": 0,
          "count": 43,
          "max": 0,
          "min": 0
        },
        "couch_httpd": 0,
        "couch_httpd_vhost": 0,
        "couch_index_server": 0,
        "couch_index_sup": 0,
        "couch_log_server": 0,
        "couch_log_sup": 0,
        "couch_plugin": 0,
        "couch_primary_services": 0,
        "couch_proc_manager": 0,
        "couch_replication": 0,
        "couch_replicator_clustering": 0,
        "couch_replicator_connection": 0,
        "couch_replicator_doc_processor": 0,
        "couch_replicator_rate_limiter": 0,
        "couch_replicator_scheduler": 0,
        "couch_replicator_scheduler_sup": 0,
        "couch_replicator_sup": 0,
        "couch_secondary_services": 0,
        "couch_server": 0,
        "couch_stats_aggregator": 0,
        "couch_stats_process_tracker": 0,
        "couch_stats_sup": 0,
        "couch_sup": 0,
        "couch_task_status": 0,
        "couch_uuids": 0,
        "cpu_sup": 0,
        "custodian_db_checker": 0,
        "custodian_server": 0,
        "custodian_sup": 0,
        "ddoc_cache_lru": 0,
        "ddoc_cache_opener": 0,
        "ddoc_cache_sup": 0,
        "disksup": 0,
        "dreyfus_index_manager": 0,
        "dreyfus_sup": 0,
        "epep_access_token_cache": 0,
        "epep_decision_cache": 0,
        "epep_key_cache": 0,
        "epep_pdp_status": 0,
        "epep_sup": 0,
        "erl_epmd": 0,
        "erl_prim_loader": 0,
        "error_logger": 0,
        "file_server_2": 0,
        "folsom_meter_timer_server": 0,
        "folsom_metrics_histogram_ets": 0,
        "folsom_sample_slide_sup": 0,
        "folsom_sup": 0,
        "ftp_sup": 0,
        "global_changes_server": 0,
        "global_changes_sup": 0,
        "global_group": 0,
        "global_name_server": 0,
        "hastings_index_manager": 0,
        "hastings_sup": 0,
        "hastings_vacuum": 0,
        "httpc_handler_sup": 0,
        "httpc_manager": 0,
        "httpc_profile_sup": 0,
        "httpc_sup": 0,
        "httpd_sup": 0,
        "ibrowse": 0,
        "ibrowse_sup": 0,
        "inet_db": 0,
        "inet_gethost_native": 0,
        "inet_gethost_native_sup": 0,
        "inets_sup": 0,
        "init": 0,
        "ioq_osq": 0,
        "ioq_server": 0,
        "ioq_server_1": 0,
        "ioq_server_2": 0,
        "ioq_server_3": 0,
        "ioq_server_4": 0,
        "ioq_server_5": 0,
        "ioq_server_6": 0,
        "ioq_server_7": 0,
        "ioq_server_8": 0,
        "ioq_sup": 0,
        "ken_server": 0,
        "ken_sup": 0,
        "kernel_safe_sup": 0,
        "kernel_sup": 0,
        "mango_sup": 0,
        "marge_server": 0,
        "marge_sup": 0,
        "mem3_events": 0,
        "mem3_nodes": 0,
        "mem3_shards": 0,
        "mem3_sup": 0,
        "mem3_sync": 0,
        "mem3_sync_nodes": 0,
        "memsup": 0,
        "mochiweb_clock": 0,
        "net_kernel": 0,
        "net_sup": 0,
        "os_cmd_port_creator": 0,
        "os_mon_sup": 0,
        "overload": 0,
        "release_handler": 0,
        "rex": 0,
        "rexi_buffer_mon": 0,
        "rexi_buffer_node1@xxx.xxx.xxx.xxx": 0,
        "rexi_buffer_node2@xxx.xxx.xxx.xxx": 0,
        "rexi_buffer_node3@xxx.xxx.xxx.xxx": 0,
        "rexi_buffer_sup": 0,
        "rexi_server": 0,
        "rexi_server_mon": 0,
        "rexi_server_node1@xxx.xxx.xxx.xxx": 0,
        "rexi_server_node2@xxx.xxx.xxx.xxx": 0,
        "rexi_server_node3@xxx.xxx.xxx.xxx": 0,
        "rexi_server_sup": 0,
        "rexi_sup": 0,
        "runtime_tools_sup": 0,
        "sasl_safe_sup": 0,
        "sasl_sup": 0,
        "showroom_gc_monitor": 0,
        "showroom_sup": 0,
        "smoosh_server": 0,
        "smoosh_sup": 0,
        "ssl_listen_tracker_sup": 0,
        "ssl_manager": 0,
        "ssl_sup": 0,
        "standard_error": 0,
        "standard_error_sup": 0,
        "tftp_sup": 0,
        "timer_server": 0,
        "tls_connection_sup": 0,
        "user": 0
      },
      "os_proc_count": 9,
      "process_count": 511,
      "process_limit": 1048576,
      "reductions": 1630312114845,
      "run_queue": 0,
      "stale_proc_count": 0,
      "uptime": 2048037,
      "words_reclaimed": 3906743947986
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers for system-level statistics for the running server

Retrieves the HTTP headers for system-level statistics for the running server.

HEAD /_node/{node_name}/_system

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.node-system.read

Request

Path Parameters

  • Path parameter to specify the node name.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header returning the server information.

  • Header returning an identifier for the request.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_node/{node_name}/_system style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve information about whether the server is up

Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response.

Tip: The authentication for this endpoint is only enforced when using IAM.

Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response.

Tip: The authentication for this endpoint is only enforced when using IAM.

Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response.

Tip: The authentication for this endpoint is only enforced when using IAM.

Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response.

Tip: The authentication for this endpoint is only enforced when using IAM.

Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response.

Tip: The authentication for this endpoint is only enforced when using IAM.

GET /_up
(cloudant *CloudantV1) GetUpInformation(getUpInformationOptions *GetUpInformationOptions) (result *UpInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetUpInformationWithContext(ctx context.Context, getUpInformationOptions *GetUpInformationOptions) (result *UpInformation, response *core.DetailedResponse, err error)
ServiceCall<UpInformation> getUpInformation()
getUpInformation(params)
get_up_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-up.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X GET "$SERVICE_URL/_up"
    
  • getUpInformationOptions := service.NewGetUpInformationOptions()
    
    upInformation, response, err := service.GetUpInformation(getUpInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(upInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.UpInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    UpInformation response =
        service.getUpInformation().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getUpInformation().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_up_information().get_result()
    
    print(response)
    

Response

Schema for information about the up state of the server.

Schema for information about the up state of the server.

Schema for information about the up state of the server.

Schema for information about the up state of the server.

Schema for information about the up state of the server.

Status Code

  • HTTP response for /_up style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP response for /_up style operations.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example UpInformation response.

    {
      "seeds": {},
      "status": "ok"
    }
  • Example UpInformation response.

    {
      "seeds": {},
      "status": "ok"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example UpInformation response for maintenance mode.

    {
      "seeds": {},
      "status": "maintenance_mode"
    }
  • Example UpInformation response for maintenance mode.

    {
      "seeds": {},
      "status": "maintenance_mode"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve HTTP headers about whether the server is up

Retrieves the HTTP headers about whether the server is up.

Retrieves the HTTP headers about whether the server is up.

Retrieves the HTTP headers about whether the server is up.

Retrieves the HTTP headers about whether the server is up.

Retrieves the HTTP headers about whether the server is up.

HEAD /_up
(cloudant *CloudantV1) HeadUpInformation(headUpInformationOptions *HeadUpInformationOptions) (response *core.DetailedResponse, err error)
(cloudant *CloudantV1) HeadUpInformationWithContext(ctx context.Context, headUpInformationOptions *HeadUpInformationOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> headUpInformation()
headUpInformation(params)
head_up_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-up.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-up.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

Response

Response Headers

  • Header returning the attachment size. If a compression codec is used, this value is the compressed size.

    Possible values: 0 ≤ value ≤ 10485760

  • Header returning the server response date-time.

  • Header added by proxies through which the response was sent.

  • Header returning the Cloudant IAM action of the request.

  • Header returning the Cloudant backend that handled the request.

  • Header returning the Cloudant class of the request.

Status Code

  • HTTP response for /_up style operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP response for /_up style operations.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Retrieve Activity Tracker events information

Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

GET /_api/v2/user/activity_tracker/events
(cloudant *CloudantV1) GetActivityTrackerEvents(getActivityTrackerEventsOptions *GetActivityTrackerEventsOptions) (result *ActivityTrackerEvents, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetActivityTrackerEventsWithContext(ctx context.Context, getActivityTrackerEventsOptions *GetActivityTrackerEventsOptions) (result *ActivityTrackerEvents, response *core.DetailedResponse, err error)
ServiceCall<ActivityTrackerEvents> getActivityTrackerEvents()
getActivityTrackerEvents(params)
get_activity_tracker_events(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.activity-tracker-event-types.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.activity-tracker-event-types.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • ibmcloud cloudant events-config
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" "$SERVICE_URL/_api/v2/user/activity_tracker/events"
    
  • getActivityTrackerEventsOptions := service.NewGetActivityTrackerEventsOptions()
    
    activityTrackerEvents, response, err := service.GetActivityTrackerEvents(getActivityTrackerEventsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(activityTrackerEvents, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.ActivityTrackerEvents;
    
    Cloudant service = Cloudant.newInstance();
    
    ActivityTrackerEvents response =
        service.getActivityTrackerEvents().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getActivityTrackerEvents().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_activity_tracker_events().get_result()
    
    print(response)
    

Response

Schema for Activity Tracker events.

Schema for Activity Tracker events.

Schema for Activity Tracker events.

Schema for Activity Tracker events.

Schema for Activity Tracker events.

Status Code

  • HTTP response for getActivityTrackerEvents.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example ActivityTrackerEvents request and response.

    {
      "types": [
        "management",
        "data"
      ]
    }
  • Example ActivityTrackerEvents request and response.

    {
      "types": [
        "management",
        "data"
      ]
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Modify Activity Tracker events configuration

Configure event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Configure event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Configure event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Configure event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

Configure event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.

POST /_api/v2/user/activity_tracker/events
(cloudant *CloudantV1) PostActivityTrackerEvents(postActivityTrackerEventsOptions *PostActivityTrackerEventsOptions) (result *Ok, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) PostActivityTrackerEventsWithContext(ctx context.Context, postActivityTrackerEventsOptions *PostActivityTrackerEventsOptions) (result *Ok, response *core.DetailedResponse, err error)
ServiceCall<Ok> postActivityTrackerEvents(PostActivityTrackerEventsOptions postActivityTrackerEventsOptions)
postActivityTrackerEvents(params)
post_activity_tracker_events(
        self,
        types: List[str],
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.activity-tracker-event-types.write

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.activity-tracker-event-types.write

Request

Instantiate the PostActivityTrackerEventsOptions struct and set the fields to provide parameter values for the PostActivityTrackerEvents method.

Use the PostActivityTrackerEventsOptions.Builder to create a PostActivityTrackerEventsOptions object that contains the parameter values for the postActivityTrackerEvents method.

HTTP request body for postActivityTrackerEvents.

Examples:
ActivityTrackerEvents

WithContext method only

The PostActivityTrackerEvents options.

The postActivityTrackerEvents options.

parameters

  • An array of event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance. "management" is a required element of this array.

    Allowable values: [management,data]

    Possible values: number of items ≥ 1

parameters

  • An array of event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance. "management" is a required element of this array.

    Allowable values: [management,data]

    Possible values: number of items ≥ 1

  • ibmcloud cloudant events-config-update --types management,data
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" -X POST "$SERVICE_URL/_api/v2/user/activity_tracker/events" --data '{"types": ["data", "management"]}'
    
  • postActivityTrackerEventsOptions := service.NewPostActivityTrackerEventsOptions(
      []string{"management"},
    )
    
    activityTrackerEvents, response, err := service.PostActivityTrackerEvents(postActivityTrackerEventsOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(activityTrackerEvents, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.Ok;
    import com.ibm.cloud.cloudant.v1.model.PostActivityTrackerEventsOptions;
    
    Cloudant service = Cloudant.newInstance();
    
    PostActivityTrackerEventsOptions options =
        new PostActivityTrackerEventsOptions.Builder()
            .addTypes("management")
            .build();
    
    Ok response =
        service.postActivityTrackerEvents(options).execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.postActivityTrackerEvents({
      types: ['management'],
    }).then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.post_activity_tracker_events(
      types=['management']
    ).get_result()
    
    print(response)
    

Response

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Schema for an OK result.

Status Code

  • HTTP response for Ok operations.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for payload too large.

  • HTTP error for unsupported media type.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example Ok response.

    {
      "ok": true
    }
  • Example Ok response.

    {
      "ok": true
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with an attachment size that exceeds the allowable limit.

    {
      "error": "attachment_too_large",
      "reason": "attachment_name"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request with a document size that exceeds the allowable limit.

    {
      "error": "document_too_large",
      "reason": "doc_id"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for a request size that exceeds the limit.

    {
      "error": "too_large",
      "reason": "the request entity is too large"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for unsupported media type.

    {
      "error": "bad_content_type",
      "reason": "Content-Type must be application/json"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the current provisioned throughput capacity consumption

View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.

View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.

View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.

View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.

View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.

GET /_api/v2/user/current/throughput
(cloudant *CloudantV1) GetCurrentThroughputInformation(getCurrentThroughputInformationOptions *GetCurrentThroughputInformationOptions) (result *CurrentThroughputInformation, response *core.DetailedResponse, err error)
(cloudant *CloudantV1) GetCurrentThroughputInformationWithContext(ctx context.Context, getCurrentThroughputInformationOptions *GetCurrentThroughputInformationOptions) (result *CurrentThroughputInformation, response *core.DetailedResponse, err error)
ServiceCall<CurrentThroughputInformation> getCurrentThroughputInformation()
getCurrentThroughputInformation(params)
get_current_throughput_information(
        self,
        **kwargs,
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.account-current-throughput.read

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.account-current-throughput.read

Request

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • ibmcloud cloudant throughput
  • curl -H "Authorization: Bearer $API_BEARER_TOKEN" "$SERVICE_URL/_api/v2/user/current/throughput"
    
  • getCurrentThroughputInformationOptions := service.NewGetCurrentThroughputInformationOptions()
    
    currentThroughputInformation, response, err := service.GetCurrentThroughputInformation(getCurrentThroughputInformationOptions)
    if err != nil {
      panic(err)
    }
    
    b, _ := json.MarshalIndent(currentThroughputInformation, "", "  ")
    fmt.Println(string(b))
    
  • import com.ibm.cloud.cloudant.v1.Cloudant;
    import com.ibm.cloud.cloudant.v1.model.CurrentThroughputInformation;
    
    Cloudant service = Cloudant.newInstance();
    
    CurrentThroughputInformation response =
        service.getCurrentThroughputInformation().execute().getResult();
    
    System.out.println(response);
    
  • import { CloudantV1 } from '@ibm-cloud/cloudant';
    
    const service = CloudantV1.newInstance({});
    
    service.getCurrentThroughputInformation().then(response => {
      console.log(response.result);
    });
    
  • from ibmcloudant.cloudant_v1 import CloudantV1
    
    service = CloudantV1.new_instance()
    
    response = service.get_current_throughput_information().get_result()
    
    print(response)
    

Response

Schema for information about current consumption of a provisioned throughput capacity.

Schema for information about current consumption of a provisioned throughput capacity.

Schema for information about current consumption of a provisioned throughput capacity.

Schema for information about current consumption of a provisioned throughput capacity.

Schema for information about current consumption of a provisioned throughput capacity.

Status Code

  • HTTP response for getCurrentThroughputInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example CurrentThroughputInformation response.

    {
      "throughput": {
        "query": 13,
        "read": 133,
        "write": 42
      }
    }
  • Example CurrentThroughputInformation response.

    {
      "throughput": {
        "query": 13,
        "read": 133,
        "write": 42
      }
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query the data usage for the current user.

Provides the user data usage information for the current month up to the current time in requested granularity. If no granularity specified it defaults for 12 hours period. Results are provided in time-based blocks.

GET /_api/v2/usage/data_volume

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.usage-data-volume

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.usage-data-volume

Request

Query Parameters

  • Query parameter to specify the granularity of report interval for data usage.

    Allowable values: [1,2,3,4,6,8,12,24]

    Default: 12

Response

Schema for UsageDataVolume.

Status Code

  • HTTP response for getUsageDataVolume.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Query the data usage for the current user in given time period.

Provides the user data usage information for a given time period in requested granularity. If no granularity is specified it defaults for 12 hours period. Results are provided in time-based blocks.

GET /_api/v2/usage/data_volume/{year}/{month}

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.usage-data-volume

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.usage-data-volume

Request

Path Parameters

  • Path parameter to specify the year.

    Possible values: Value must match regular expression ^\d{3}[1-9]$

  • Path parameter to specify the month.

    Possible values: Value must match regular expression ^0?[1-9]|1[012]$

Query Parameters

  • Query parameter to specify the granularity of report interval for data usage.

    Allowable values: [1,2,3,4,6,8,12,24]

    Default: 12

Response

Schema for UsageDataVolume.

Status Code

  • HTTP response for getUsageDataVolume.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieve the user information.

Provides the user document that includes both user's personal information and technical details of the account.

GET /_api/v2/user

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.userinfo

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.userinfo

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for UserInformation.

Status Code

  • HTTP response for getUserInformation.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieves CCM diagnostics for the user.

This endpoint is an authentication pass-through to retrieve the CCM diagnostics from HAProxy for a given user which requires the specific user be authenticated.

GET /_api/v2/user/ccm_diagnostics

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.userccmdiagnostics

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.userccmdiagnostics

Request

No Request Parameters

This method does not accept any request parameters.

Response

Schema for CcmDiagnostics.

Status Code

  • HTTP response for getCcmDiagnostics.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }

Retrieves a user's plan and plan history.

Returns a user's plan, optionally plan history, and plan information.

GET /_api/v2/user/plan

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cloudantnosqldb.sapi.userplan

Auditing

Calling this method generates the following auditing event.

  • cloudantnosqldb.sapi.userplan

Request

Query Parameters

  • Return user's plan history if true.

    Default: true

  • Earliest date from which to include plan changes in history

Response

Schema for UserPlan.

Status Code

  • HTTP response for putUserPlan.

  • HTTP error for bad request.

  • HTTP error for unauthorized.

  • HTTP error for payment required.

  • HTTP error for forbidden.

  • HTTP error for not found.

  • HTTP error for timeout reading client request.

  • HTTP error for gone.

  • HTTP error for too many requests.

  • HTTP error for internal server error.

  • HTTP error for bad gateway.

  • HTTP error for service unavailable.

  • HTTP error for gateway timeout.

Example responses
  • Example error response for an invalid base64 header value.

    {
      "error": "bad_request",
      "reason": "Authorization header has invalid base64 value"
    }
  • Example error response for a bad request.

    {
      "error": "bad_request",
      "reason": "Bad request."
    }
  • Example error response for a bad request for too many UUIDs.

    {
      "error": "bad_request",
      "reason": "count parameter too large"
    }
  • Example error response for a bad request deleting a database with a document rev.

    {
      "error": "bad_request",
      "reason": "You tried to DELETE a database with a ?=rev parameter. Did you mean to DELETE a document instead?"
    }
  • Example error response for a bad request missing keys.

    {
      "error": "bad_request",
      "reason": "`keys` member must exist."
    }
  • Example error response for an invalid database name.

    {
      "error": "illegal_database_name",
      "reason": "Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."
    }
  • Example error response for a bad request with invalid UTF-8 JSON.

    {
      "error": "bad_request",
      "reason": "invalid UTF-8 JSON"
    }
  • Example error response for a bad request with an invalid partition name.

    {
      "error": "bad_request",
      "reason": "invalid_partition_req"
    }
  • Example error response for a bad request with an unsupported option.

    {
      "error": "bad_request",
      "reason": "`counts` is not supported on this search index"
    }
  • Example error response for administrator privileges required.

    {
      "error": "unauthorized",
      "reason": "You are not a server admin."
    }
  • Example error response for incorrect credentials.

    {
      "error": "unauthorized",
      "reason": "Name or password is incorrect."
    }
  • Example error response for reader access is required for this request.

    {
      "error": "unauthorized",
      "reason": "_reader access is required for this request."
    }
  • Example error response for writer or creator access is required.

    {
      "error": "unauthorized",
      "reason": "one of _writer, _creator is required for this request."
    }
  • Example error response for writer access is required.

    {
      "error": "unauthorized",
      "reason": "_writer access is required for this request."
    }
  • Example error response when payment is required. For example, if the data quota of the plan is exceeded.

    {
      "error": "payment_required",
      "reason": "Payment required"
    }
  • Example error response for a forbidden request.

    {
      "error": "forbidden",
      "reason": "server_admin access is required for this request"
    }
  • Example error response for a database does not exist.

    {
      "error": "not_found",
      "reason": "Database does not exist."
    }
  • Example error response for a document ID does not exist.

    {
      "error": "not_found",
      "reason": "missing"
    }
  • Example error response for a missing view.

    {
      "error": "not_found",
      "reason": "missing_named_view"
    }
  • Example error response for timeout reading client request.

    {
      "error": "request_timeout",
      "reason": "Request timeout"
    }
  • Example error response for gone.

    {
      "error": "gone",
      "reason": "The requested resource is no longer located here, verify your DNS\nsettings.\n"
    }
  • Example error response for too many requests.

    {
      "error": "too_many_requests",
      "reason": "You`ve exceeded your rate limit allowance. Please try again later.\n"
    }
  • Example error response for an unknown server error.

    {
      "error": "unknown_error",
      "reason": "function_clause",
      "ref": 2632214382
    }
  • Example error response for bad gateway.

    {
      "error": "bad_gateway",
      "reason": "Bad gateway"
    }
  • Example error response for service unavailable.

    {
      "error": "service_unavailable",
      "reason": "Service unavailable"
    }
  • Example error response for gateway timeout.

    {
      "error": "gateway_timeout",
      "reason": "Gateway timeout"
    }