<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
How to Handle an External API Call Error in Workflows
Workflows
Okta Classic Engine
Okta Identity Engine
Overview
When calling an external API results in an error. To gracefully handle the error and continue the flow execution, one way to handle the error is to use the Error Handling – If Error card. It’s similar to try/catch logic.
Applies To
Okta Workflows
Solution

The card has two sections Try and If Error.

In the Try section, place the API Connector card followed by any other logic. In this example, there is a single Assign card to create a success message. The other cards can be added as well. The message is then mapped to the If Error card’s output.

Workflows  
If Error card – success section

In the If/Else section, there is a default error message followed by any other logic. In this example, it’s again a single Assign card that holds the error message. The message is then mapped to the If Error card’s output.

Workflows  
If Error card – error section

After the If Error card, add additional logic. Here is an example of sending a success or an error message to the Compose card.

Workflows

Now, test the flow. The flow uses a service called mock.codes. mock.codes provide an easy way to reference and test HTTP responses.

Running the flow with HTTP response 200 (https://mock.codes/200) that results in success:

Workflows

Running the flow with HTTP response 500 (https://mock.codes/500) that results in Internal Server Error:

Workflows

The flow chart helps visualize the flow logic at a high level:

Workflows  
 

Related References

Loading
How to Handle an External API Call Error in Workflows