IBM App Connect on IBM Cloud
Service plans for IBM® App Connect on IBM Cloud® are deprecated. To view documentation for an alternative provision of App Connect, use the "Change version" menu.
Calling APIs from a flow
Using IBM® App Connect, you can create flows that enable
you to call out to the endpoint for an API, and pass data between the endpoint and one or more
applications in the App Connect DesignerCatalog. You can call APIs from a
flow in a number of ways.
Invoking operations for APIs that are imported or shared in App Connect
In addition to applications, the App Connect DesignerCatalog contains any
APIs that you added by importing OpenAPI documents, and shared APIs in your IBM Cloud® organization. The
operations defined for these APIs are exposed as actions that you can add to your flows in much the
same way as the actions for applications. From the flow editor, you can add an action for an API
from the APIs tab.
The following example shows some actions that are exposed for a shared API's operations. (We
are going to choose the POST action so we can view its fields.)
Figure 1. Selecting an action for an API in the flow editor
(Click image to view full size.)
Note: To use an API in a flow, you must first connect App Connect
to the API by using the security scheme that's configured for that API.
When you add an action for your API to a flow, the parameters defined for the associated
operation are exposed as fields that you can complete with text, mapped fields from previous nodes
in the flow, or JSONata expressions; for example:
Figure 2. Sample fields for an API action
(Click image to view full size.)
For more information about how to connect to imported or shared APIs, guidelines and restrictions
for the APIs you can connect to, and how to call APIs from App Connect, see the following topics:
Calling out to an API endpoint by using the invoke method for the HTTP application
Another way in which you can call an API from a flow is to add an HTTP "Invoke method" action as
a node in your flow. From the flow editor, you can add an "Invoke method" node for HTTP from the
Applications tab; for example:
Figure 3. Selecting the HTTP Invoke method action in the flow
editor
(Click image to view full size.)
Note: To call an API by using an HTTP "Invoke method" action, you'll need to connect App Connect to the API by using the security scheme configured for that
API.
After you add the HTTP "Invoke method" action, you can complete the fields by specifying the type
of HTTP method to be used to make a call, the URL of the API endpoint being called, and other
optional values. You can specify text, mapped fields from previous nodes in the flow, or JSONata
expressions in the fields.
Figure 4. Fields for an HTTP Invoke method action
(Click image to view full size.)
For more information about connecting to an HTTP endpoint from App Connect and calling the endpoint by using an HTTP "Invoke method"
action, see How to use IBM App Connect with HTTP.