We are pleased to announce the release of Couchbase Cloud version 1.6, which introduces features that streamline account administration, enhance data migration and simplify how you work with Couchbase Cloud.
In this post I’ll provide a general overview of the new features, which include a public API, an improved data import capability, an easier sign/up experience and expanded AWS regional coverage. Because of its importance to the new features list, I’ll spend the majority of this post on the awesome new API.
Couchbase Cloud API
The Couchbase Cloud API is an important and powerful feature that opens new doors for automating operations on your Couchbase Cloud account. It allows you to programmatically interact with the Couchbase Cloud Control Plane to perform a variety of administrative functions using secure RESTful APIs.
The APIs allow you to create and delete clusters, buckets, and database users, as well as list clouds, manage projects, and more. Using the APIs, you can create applications that automate repetitive manual tasks, such as spinning up new clusters and users for new applications, and you can use it to integrate Control Plane functionality into other applications, or use it to build applications that provide real-time insight into your Couchbase Cloud database ecosystem.
The Couchbase Cloud API enables customers to integrate with Couchbase Cloud for performing operations on their account, such as:
-
- Onboarding / offboarding users
- Managing the lifecycle of a cluster
- Obtaining monitoring information for a cluster
The first iteration of the Public API focuses on the lifecycle of a cluster and associated functionality. At a high level, the API can perform the following functions:
For Clusters
-
- List, create and delete clusters, buckets, users
- Manage access with Allow List
For Projects
-
- List, create and delete projects
For Clouds
-
- List clouds and obtain detailed information about them
API Endpoints
The following table lists the Public API endpoints and methods you can use in your applications:
baseURL = “https://cloudapi.cloud.couchbase.com”
API | Methods | Description |
{baseURL}/v2/status | GET | Returns the status of Public APIs |
{baseURL}/v2/clouds | GET | Returns a paginated list of summary information about each cloud |
{baseURL}/v2/clouds/{id} | GET | Returns detailed information about a cloud |
{baseURL}/v2/projects | GET, POST | Returns a paginated list of summary information about each project ( GET ) or to create a project ( POST ) |
{baseURL}/v2/projects/{id} | GET, DELETE | Returns detailed information about a project ( GET ) or deletes it ( DELETE ) |
{baseURL}/v2/clusters | GET, POST | Returns a paginated list of summary information about each cluster ( GET ) or to create a cluster ( POST ) |
{baseURL}/v2/clusters/{id} | GET, DELETE | Returns detailed information about a project ( GET ) or deletes it ( DELETE ) |
{baseURL}/v2/clusters/{id}/buckets | GET, POST, DELETE | Returns detailed information about a bucket ( GET ), creates a bucket ( POST ) or deletes it ( DELETE ) |
{baseURL}/v2/clusters/{id}/allowlist | GET, POST, DELETE | Returns detailed information about an allow list ( GET ), creates an allow list ( POST ) or deletes it ( DELETE ) |
API Information Flow
The Couchbase Cloud API is secure, using TLS encryption for communications. It also requires an access key and a secret key for authentication and authorization.
The following diagram illustrates the basic information flow when using the API:
- Secure REST calls are made from the customers operation application to the Couchbase Cloud Public API Service endpoints.
- The API Service passes each call to the Couchbase Cloud Control Plane, which then passes the call to the Data Plane in the customers account.
- Operations are performed on the Data Plane and responses are sent back through the Control Plane to the API Service, then to the customers operation application.
Basic Usage and Calling an Endpoint
Using the API is straightforward, consisting of 3 steps:
- Generate API Keys
- Create Access Key and Secret Key using the Couchbase Cloud Control Plane
- Authenticate
- Generate the Header using Authorization and Couchbase-Timestamp
- Call the API
- Include the authentication header and execute the REST call
The Public API Reference provides details on all of the available endpoints, including parameters and responses. This reference guide is an essential resource for learning the ins and outs of the API.
Documentation on how to generate the API keys and header can be found here, let’s take a quick look at how to call an API endpoint.
Suppose you are using Couchbase Cloud to power a variety of applications across multiple clouds and cloud providers, for example AWS and Azure. To maintain efficient operations it would be important to understand the current state of your cloud ecosystem, what each cloud’s status is at any given time. As part of an operations application, you can include this information by calling the Clouds
endpoint.
Calling the Clouds endpoint returns a paginated list of all clouds in your account, including information such as name, status, cloud provider and region. You call the endpoint like so: GET /v2/clouds
The Clouds endpoint returns ListCloudsResponse with the CloudSummary data fields:
Here’s a simple example of calling the Clouds endpoint using Python, where the get_clouds_from_api function calls the endpoint, then takes each cloud name, provider, region and id field returned in the ListCloudsResponse data and builds them into a row for displaying in a table:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
def get_clouds_from_api(): clouds_api_response = cbc_api_get('/v2/clouds') cloud_list = [] if clouds_api_response['responseStatus'] is not None: list_of_clouds = clouds_api_response['responseContent'] # Did we get a list? if list_of_clouds is not None: for cloud in list_of_clouds['data']: # Builds up a row to display in a table cloud_list.append([cloud['name'],cloud['provider'] , cloud['region'], cloud['id']]) return(cloud_list) |
To see this code in action, and try out a variety of other pre-built sample apps that do things like creating and deleting clusters, listing users, creating projects, and more, take advantage of the Couchbase Cloud API examples, a full complement of working applications that you can use to learn the API and jumpstart your own application development. Instructions for getting started with the API samples can be found here.
Using the API is as straightforward as it is powerful, easily allowing you to programmatically call the Couchbase Cloud Control Plane to automate repetitive manual tasks. For example, using the API, customers who leverage Couchbase Cloud to power multiple short-lifecycle applications – such as development sandboxes where new clusters are created and old clusters are decommissioned on a frequent basis – can streamline the process by creating a utility that provisions clusters, manages them and then destroys them when they are no longer needed.
The utility could list summaries for clouds, projects, clusters, and obtain detailed data for each in real time, helping the organization manage their Couchbase Cloud ecosystem more efficiently and effectively. This is just one example of the many ways the API can be used, we’re excited about the new feature and we expect that customers will put it to great use!
Improved Data Import
Couchbase Cloud 1.6 also introduces an enhanced import functionality that enables you to migrate data to Couchbase Cloud more easily and in new ways. Using the new Import Tools interface, you can now import JSON (lines, list, and archive) and CSV files into Couchbase Cloud from a local machine using your browser or manually using a cURL command provided by the API.
An important aspect of the new feature is that keys for each document extracted from a CSV row or JSON list flat file can be auto-generated (UUID), or specified using a Generated Key Name Expression that follows the same syntax used by the cbimport utility (which powers the new feature).
The ability for custom key generation is a welcome enhancement that will simplify and streamline data migration efforts for Couchbase Cloud customers.
When creating an import, you can select from a variety of configuration options, including Skip Documents, Limit Documents, Ignore Fields, Infer Field Types (CSV only), and Omit Empty Fields (CSV only). Other enhanced capabilities include asynchronous or concurrent actions, activity tracking, email notifications for long running imports, re-import and more.
The new Import feature becomes another way in which customers can migrate data into Couchbase Cloud, along with Backup/Restore and XDCR.
Other New Features
Streamlined sign-up experience
Improvements have been made to the sign-up flow for Couchbase Cloud to better guide new customers through the process and get signed up as quickly and easily as possible. To sign up for Couchbase Cloud, visit Sign Up for Couchbase Cloud.
Expanded AWS Region Coverage
Couchbase Cloud continues to grow it’s supported regions around the globe, and is now available in the AWS Middle East (Bahrain) Region. For a complete list of supported AWS regions, see Cloud Provider Requirements for AWS.
My colleague Prasad Doddi wrote an in depth blog covering the new Couchbase Cloud Import feature that includes a great tutorial of the new Import Tools interface. I highly recommend reading it!
The latest features in Couchbase Cloud confirm our commitment to making the service as powerful and easy to use as possible for customers.
If you haven’t taken advantage of the Couchbase Cloud Free Trial yet, now is the time to see for yourself how easy it is to get started!