<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 Call an API when It Is Not Available from an Existing Card (Connection)
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

This article describes how to call an API when it is unavailable from an existing card (connection).

There are three ways to call in API:

  • Using an available Workflows app connection
  • Using a Workflows app connection with a custom API endpoint
  • Calling custom API endpoint (when no card is available)
Applies To
  • Okta Workflows
Solution

Using an available Workflows app connection

Workflows has over 50 out-of-the-box connections to various external services:

various external services  
 

Each connection supports a number of actions. This is a partial list of actions supported by the Google Calendar card:

Google Calendar card  
 

Behind the scenes, each action is an API call to the Google Calendar API. What is nice, of course, the Google Calendar card does the API call setup automatically. It knows the API endpoint, the headers, the (query) parameters, and anything else needed. Here is an example of searching for events using the Google Calendar – Search card:

Search Events card  


 

Leveraging a Workflows app connection with a custom API endpoint

Looking at another app connection, Shopify, it has the following actions:

Shopify  
 

When a new customer needs to be created, use the Shopify – Create Customer card:

Create Customer card  
 

Next, list the available customers. When looking at the app actions, no such action is available. It is possible to use the Custom API Connection card to call a Shopify API endpoint and leverage an existing connection to Shopify.

Custom API Action card  
 

Using the Shopify – Custom API Action card, enter the Relative URL. There is no need to enter the host or the authentication information, as it leverages the existing connection to Shopify. It is possible to enter Query or additional Headers if a particular endpoint requires that.

Testing the Customer API Action card with /admin/api/2022-01/customers.json endpoint results in listing four customers:

Test "Custom API Action"  
 

Confirm this by calling the /admin/api/2022-07/customers/count.json endpoint to return the count of customers:

/customers/count.json endpoint

 

Calling a custom API endpoint

It is recommended to use the ShipEngine API to validate physical addresses. Workflows does not have a connector for ShipEngine. For such cases, use the API Connector card to call any external API.

When using the API Connector card, it is necessary to enter all the information to call a particular API endpoint. Usually, go to API’s documentation to learn how to set up a call.

When using the API Connector – Post card for ShipEngine’s Validate an Address endpoint, it is necessary to provide:

  • URL
  • Headers (for API key)
  • Body (a list of addresses to validate)

API Connector – Post card  
 

When the API call is successful, the result says an address was verified and also returns a matched address:

Successful API

NOTE: If using ShipEngine’s API often and in different flows, it is possible to setup a connection that holds the authentication information for a particular API. With ShipEngine API, put the API-Key header there:

New Connection  
 

Is no longer needed to provide the API key in Headers:

APO Connector Post  
 

This guide showed how to use the Custom API Action card and the API Connection card to call APIs when they (APIs) are not available as part of the out-of-the-box connect.

 

Related References


 

Loading
How to Call an API when It Is Not Available from an Existing Card (Connection)