How to use IBM App Connect with IBM Cloudant

IBM Cloudant, a highly scalable and performant JSON (JavaScript Object Notation) database service, stores JSON formatted documents. Thanks to functionality offered in App Connect, you do not have to write this JSON by hand, but you are able to define the document properties (names and data types) and then map to those properties as you would any other properties in App Connect.
Availability:
  • A connector in IBM App Connect on IBM CloudCloud-managed connector
  • A local connector in a Designer instance of IBM App Connect in containers (Continuous Delivery release)Local connector in containers (Continuous Delivery release)
  • A local connector in a Designer instance of IBM App Connect in containers (Extended Update Support)Local connector in containers (Extended User Support release)
  • A local connector in a Designer instance of IBM App Connect in containers (Long Term Support)Local connector in containers (Long Term Support release)

Connecting to IBM Cloudant

To connect App Connect to an IBM Cloudant account that you want App Connect to use, you need the following connection details:

  • If your service instance uses IBM Cloud® Identity and Access Management (IAM) authentication only, or both legacy credentials and IAM, provide the following connection details:
    • Cloudant host: The host name of the instance
    • Cloudant API key: The API key for the instance
  • If your service instance uses legacy credentials for authentication, provide the following connection details:
    • Cloudant user name: The name of the service instance user
    • Cloudant password: The password for the specified user name
    • Example of completed fields for connecting from App Connect using IAM authentication only, or both legacy credentials and IAM Connect to Cloudant form
You can find the connection values on the 'Service credentials' page for the service instance in IBM Cloud:
  1. Log in to IBM Cloud.
  2. From the IBM Cloud Dashboard, click the Cloudant service instance that you want to work with.
  3. To view the service credentials, click Service credentials in the left pane, and then click View credentials. (If you want to define new credentials to use, click New credential.)
    • If your service instance supports IAM authentication only, or both legacy credentials and IAM, copy the host and API key values, and paste them into the App Connect fields. Cloudant credentials (IAM)
    • If your service instance uses legacy (Cloud Foundry) authentication, copy the user name and password, and paste them into the App Connect fields.
      Cloudant credentials

      (Click the image to view full size.)

To connect to IBM Cloudant from the App Connect Designer Catalog page for the first time, under IBM Cloudant click Connect. This creates an account in App Connect. For more information about ways to connect to IBM Cloudant, see Managing accounts in App Connect.

Tip:

Before you use the account that is created in App Connect in a flow, rename the account to something meaningful that helps you to identify it. To rename the account on the Catalog page, select the account, open its options menu (⋮), then click Rename Account.

What should I consider first?

Before you use App Connect Designer with IBM Cloudant, take note of the following considerations:

  • To use Cloudant with App Connect, you must have provisioned a Cloudant NoSQL DB service on IBM Cloud.
  • To configure the New document action, the Document ID field is optional. If you do not specify a value or data mapping, IBM Cloudant will assign an ID to the document created.
  • You can specify your Cloudant document data structure as data properties (with name and data type) or as a JSON object that consists of comma-separated name/value pairs. For example:
    • Cloudant document data structure specified as data properties:
      Cloudant document data structure as data properties

      (Click the image to view full size.)

      To specify your Cloudant document data structure as data properties, click Add property under the 'Document data' heading. (If you have been specifying document data as JSON, ensure that the ‘Document data’ field is empty and then click Add property.) For more information about specifying data properties, see Defining your own data properties.

    • Cloudant document data structure specified as JSON:
      Cloudant document data structure as JSON

      (Click the image to view full size.)

      To specify your Cloudant document data structure as JSON, ensure that there are no properties under the ‘Document data’ heading and then click ‘Edit mappings’.

  • (General consideration) You can see lists of the trigger events and actions that are available on the Catalog page of the App Connect Designer.

    For some applications, the events and actions in the catalog depend on the environment (IBM Cloud Pak for Integration or App Connect on IBM Cloud) and whether the connector supports configurable events and dynamic discovery of actions. If the application supports configurable events, you see a Show more configurable events link under the events list. If the application supports dynamic discovery of actions, you see a Show more link under the actions list.

  • (General consideration) If you are using multiple accounts for an application, the set of fields that is displayed when you select an action for that application can vary for different accounts. In the flow editor, some applications always provide a curated set of static fields for an action. Other applications use dynamic discovery to retrieve the set of fields that are configured on the instance that you are connected to. For example, if you have two accounts for two instances of an application, the first account might use settings that are ready for immediate use. However, the second account might be configured with extra custom fields.

Events and actions

IBM Cloudant events

These events are for changes in this application that trigger a flow to start performing the actions in the flow.

Note: Events are not available for changes in this application. You can trigger a flow in other ways, such as at a scheduled interval or at specific dates and times.

IBM Cloudant actions

These are actions on this application that you want a flow to complete.

Attachments
Create attachment
Retrieve attachments
Update or create attachment
Databases
Create database
Retrieve databases
Delete database
Documents
Create document
Retrieve documents
Update document
Update or create document
Delete document
Views
Apply view

More items are available when you have connected App Connect to IBM Cloudant.

Examples

Screenshot of the dashboard tile for a template that uses IBM Cloudant

Creating an event-driven flow that syncs updates to Salesforce data with IBM Cloudant documents

Learn how to use App Connect Designer to create an event-driven flow that when a new Salesforce contact is created, creates a document in IBM Cloudant with data from Salesforce. This tutorial demonstrates how to easily specify your own data properties for an IBM Cloudant document, without needing to write JSON.