Call External API Behavior
Summary
Allows LearningBuilder to make arbitrary HTTP requests to external systems and then use the response to update Workflow attributes.
Overview
This Behavior makes an API call to a generic external API and can save the response in an Attribute value.
The API endpoint that gets called is provided by an REST API Endpoint defined in App Config. We currently support Basic Authentication only.
This supports “fire and forget” API calls only that involve a single outbound API call.
APIs that require a “conversation” of multiple API calls can be supported by implementing a custom Lambda wrapper endpoint, which requires advanced technical customization.
Configuration
Field | Purpose |
---|---|
As configured by | Indicates how the Behavior determines the API endpoint and payload details. API Endpoint + System Template is the recommended approach. It uses REST Api Endpoints to determine the endpoint and authentication details and a System Template to provide the API payload. Template Attribute is a legacy, deprecated approach. It uses a Template Attribute, defined on a specific Workflow, to generate the API endpoint, authentication headers, and payload. |
Request Timeout | How long in seconds to wait for the API call to finish before abandoning it. The entire user request (that triggers the Behavior) must finish in 30 seconds or less, so the recommended value here is ~5 seconds in case multiple Behaviors are joined together. |
Raw Response Attribute | An Attribute to store the entire API response. This is generally intended for logging and troubleshooting purposes and generally should not be displayed to end users. |
Process the response using | A Custom Script that can optionally be used to extract a meaningful value from the raw response for storage on another Attribute. For example, assume the API returns a JSON response like this: {
result: "Success",
timestamp: "1/1/2024 12:12 PM",
responsibleParty: "Joe Schmoe"
} If the “Joe Schmoe” part of the response is significant and affects other parts of the system, then a custom script can be used to extract that string from the raw response. |