How to Call an API When It’s Not Available From an Existing Card (Connection)?
Tags: nocode, workflows, api, tutorial
Published: 2022-09-01 17:02:18

---
title: How to Call an API When It’s Not Available From an Existing Card (Connection)?
published: true
date: 2022-09-01 04:49:00 UTC
tags: NoCode, Workflows, api, tutorial
canonical_url: https://maxkatz.net/2022/07/14/how-to-call-an-api-when-its-not-available-from-an-existing-card-connection/
---

[Okta Workflows](https://www.okta.com/platform/workflows/) how-to guides are questions and answers from weekly community [office hours](https://calendly.com/oktaworkflows/group-office-hours-okta-workflows), MacAdmins [Workflows Slack channel](https://www.macadmins.org/), and other places. 

Read all the other how-to guides ⤵️
{% embed https://dev.to/oktaworkflows/all-okta-workflows-how-to-guides-4nl9 %}

On to the question. 

**_How to call an API when it’s not available from an existing card (connection)?_**

You will learn about 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)

## Using an available Workflows app connection

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

[![Workflows app connections](https://katzmax.files.wordpress.com/2022/07/workflows_howto_custom_api_connections.png?w=798)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_custom_api_connections.png)
<figcaption>Workflows app connections</figcaption>

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

[![Google Calendar app actions](https://katzmax.files.wordpress.com/2022/07/workflows_howto_custom_api_googlecalendar.png?w=836)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_custom_api_googlecalendar.png)
<figcaption>Google Calendar app actions</figcaption>

Behind the scenes each action is an API call to Google Calendar. What’s 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 searching for events using **Google Calendar – Search** card:

[![Searching a calendar with Google Calendar – Search Events card](https://katzmax.files.wordpress.com/2022/07/workflows_howto_custom_api_googlecalendar_search.png?w=487)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_custom_api_googlecalendar_search.png)
<figcaption>Searching a calendar with Google Calendar – Search Events card</figcaption>

## Leveraging a Workflows app connection with a custom API endpoint

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

[![Shopify connection actions](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_actions.png?w=872)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_actions.png)
<figcaption>Shopify connection actions</figcaption>

When you need to create a new customer, you use the **Shopify – Create Customer** card:

[![Creating a new customer with Shopify app connection](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_customer.png?w=399)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_customer.png)
<figcaption>Creating a new customer with Shopify app connection</figcaption>

Now you want to [list the customers](https://shopify.dev/api/admin-rest/2022-07/resources/customer#get-customers) you have. When you look at the app actions, no such action is available. You can use the **Custom API Connection** card to call a Shopify API endpoint and leverage an existing connection to Shopify.

[![Shopify – Custom API Action card](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_custom.png?w=396)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_custom.png)
<figcaption>Shopify – Custom API Action card</figcaption>

Using the **Shopify – Custom API Action** card, you enter the **Relative URL**. You you don’t need to enter the host or the authentication information as it leverages the existing connection to Shopify. You can 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:

[![Retrieving a list of customers using Shopify – Custom API Action card](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customerapi_shopify_list_customers.png?w=1024)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customerapi_shopify_list_customers.png)
<figcaption>Retrieving a list of customers using Shopify – Custom API Action card</figcaption>

You can confirm this by calling the `/admin/api/2022-07/customers/count.json` endpoint to return the [count of customers](https://shopify.dev/api/admin-rest/2022-07/resources/customer#get-customers-count):

[![Retrieving a count of customers using Shopify – Custom API Action card](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_count.png?w=1024)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shopify_count.png)
<figcaption>Retrieving a count of customers using Shopify – Custom API Action card</figcaption>

## Calling a custom API endpoint

You want to use [ShipEngine](https://www.shipengine.com/) API to validate physical addresses. Workflows doesn’t have a connector for ShipEngine. For such cases you can use the **API Connector** card which allows to call any external API.

When using the **API Connector** card, you need to enter all the information to call a particular API endpoint. Usually you would go to API’s documentation to learn how to setup a call.

Using **API Connector – Post** card for ShipEngine’s [Validate an Address](https://www.shipengine.com/docs/addresses/validation/) endpoint you need to provide:

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

[![Calling ShipEngine API with API Connector card](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customap_shipengine_api.png?w=1024)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customap_shipengine_api.png)
<figcaption>Calling ShipEngine API with API Connector card</figcaption>

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

[![Address validation with ShipEngine API](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shipengine_result.png?w=1024)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shipengine_result.png)
<figcaption>Address validation with ShipEngine API</figcaption>

One tip I want to share. If you use ShipEngine’s API often and in different flows, you can setup a connection which holds the authentication information for a particular API. With ShipEngine API, put the **API-Key** header there:

[![Creating a new connection](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shipengeine_create_custom_connection.png?w=983)](https://katzmax.files.wordpress.com/2022/07/workflows_howto_customapi_shipengeine_create_custom_connection.png)
<figcaption>Creating a new connection</figcaption>

You no longer need to provide the API key in **Headers** :

[![API Connector with pre-set connection](https://katzmax.files.wordpress.com/2022/07/workflwos_howto_customapi_shipengine_api_connection.png?w=408)](https://katzmax.files.wordpress.com/2022/07/workflwos_howto_customapi_shipengine_api_connection.png)
<figcaption>iAPI Connector with pre-set connection</figcaption>

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

* * *

📺 Short how-to [Workflows videos](https://youtube.com/playlist?list=PLIid085fSVdvyK8F4xuk49EchBPmAVNHG) to help you become a better automation builder.

🔮 A collection of helpful [Workflows tips](https://maxkatz.net/okta-workflows-tips/).