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 catalog. You can call APIs from a flow in a number of ways.
- Invoking operations for APIs that are imported or shared in App Connect
- Calling out to an API endpoint by using the invoke method for the HTTP application
Invoking operations for APIs that are imported or shared in App Connect
In addition to applications, the App Connect catalog 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.)
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 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:
- How to use IBM App Connect with APIs imported from OpenAPI documents
- How to use IBM App Connect with shared APIs in IBM Cloud
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.
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 method to be used to make a call, 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.
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.