Introduction

IBM Cloud APIs can be shared across different spaces in an IBM Cloud organization. A number of areas of the IBM Cloud platform can share APIs including IBM App Connect, IBM Cloud Functions (formerly OpenWhisk) and Cloud Foundry. For an overview, see here.

App Connect now displays all of the APIs that are shared across the IBM Cloud organization that it is running in. This allows APIs to be treated in the same way as applications and be included in flows. This means that greater collaboration across the enterprise can be achieved.

The inclusion of shared APIs presents several new use cases including:

  • Being able to treat an App Connect API flow in the same way as any other application and call it from within another flow
  • Being able to call out to APIs defined in other areas of IBM Cloud, like Cloud Functions, from within a flow
  • Being able to reference App Connect API flows defined in a different IBM Cloud space

This article will focus on sharing an existing App Connect API flow, then using it in another flow. The features shown require an App Connect instance running on IBM Cloud.

Shared APIs

The first step is to share the API flow in App Connect.

    1. Navigate to the flow and select the Manage tab and then under the Sharing within Cloud Foundry organization section, set Include API in organization-level Shared APIs view to on.If the API requires a client ID to be called, then create a key under the Sharing Outside of Cloud Foundry organization section.

      Note: The reason for generating the key in the Sharing Outside of Cloud Foundry organization section is that the API call will come from the App Connect organization, which isn’t the same as this user’s instance, and is therefore outside of this organization.

      The API should now be visible on the IBM Cloud shared APIs page.

    2. From the App Connect dashboard, navigate to the Catalog tab to view the list of applications and APIs that are available. The APIs tab will show a list combining the shared APIs discovered from IBM Cloud (which could include App Connect, Cloud Functions and Cloud Foundry APIs) along with any OpenAPI user-defined applications that have been created by uploading an OpenAPI document into App Connect. APIs created by uploading an OpenAPI document will be tagged as “Imported”.
    3. Click the shared API to validate it and determine whether it can be used in App Connect. For details on current restrictions see the documentation.
    4. Once validated, the connection details can be entered (a connection is required in order to use this API in a flow). Enter the value of the key created earlier on the APIs Manage tab.

At this point the API will behave in the same way as other applications in App Connect.

APIs in a flow

      1. To add an API to a flow, navigate to the App Connect dashboard and create a flow (in this example using Event-driven flow).
      2. From the Applications tab, choose a source application and action that will trigger your flow. Then, click the APIs tab, select an API from the list of connected APIs, and select an action (or operation). APIs can only be used as actions within flows, not events at the start of flows.
        The shared API is now in the flow and can be used in the same way as other applications.

Conclusion

This article has outlined some key steps needed to incorporate APIs shared across an IBM Cloud organization into App Connect flows. While these steps focused on reusing an API flow created in App Connect in other flows, the steps are equally valid for APIs created in other areas of IBM Cloud (for example Cloud Functions).

Join The Discussion

Your email address will not be published. Required fields are marked *