Home SalesforceFlow Verify API Connection in Flow HTTP Callout

Verify API Connection in Flow HTTP Callout

by Dhanik Lal Sahni
HTTP Callout

Salesforce’s Flow HTTP Callout is a powerful tool that allows you to easily connect external web services and retrieve or alter data from remote systems within your Flow. This allows you to incorporate external systems and APIs into your automated processes, enhancing Salesforce’s capabilities and optimising procedures.

While configuring API connection in HTTP Callout, we provide a response sample JSON to create response classes and structure. Now we can also test the configured HTTP Callout connection and get the sample response while we configure HTTP Callout. We have the feature Connect for Schema in HTTP Callout to test and get the response from the configured external system. This post will provide step-by-step information to use the Connect for Schema feature in the HTTP Callout flow.

Steps to verify Flow HTTP Callout Connection

In this post, we will create a connection with the JIRA REST API. This API will require Basic Authentication. We will create basic authentication parameters in the named principal and add authorization parameters in the external credentials. This generated authentication token is added to each request using the named credential headers setting.

The below steps will be involved to verify the HTTP Callout connection.

  1. Create an External Credential
  2. Create a Named Principal
  3. Create a Permission Set
  4. Create a Named Credential
  5. Update External Credential Basic authentication
  6. Create HTTP Callout Action and Test Endpoint Connection

1. Create an External Credential

Create an External Credential for JIRA API Integration. External Credentials will be used to store authentication information for JIRA.

Create an external credential named Jira External Credential EC (JiraExternalCredentialEC) that will support custom authentication

External Credential | HTTP Callout |SalesforceCodex

2. Create a Named Principal

We will need a named principal that applies authentication configuration to the named credential. Create a named principal with the name Jira Principal.

Named Principal | SalesforceCodex

As we need to connect JIRA REST API. This API needs Basic authentication to retrieve Jira project issues. We need to add two parameters in Named Principal.

Parameter NameParameter Name
Username<Jira Username>
Password<Jira API Token>
Named Principal Parameters | SalesforceCodex

Jira API token can be generated from https://id.atlassian.com/manage-profile/security/api-tokens for your JIRA project.

Jira API Token | SalesforceCodex

3. Create a Permission Set

Create a permission set to provide user access to this external credential. Create a permission set External System PS and assign the above-created external credential Jira External Credential EC in External Credential Principal Access. Once a permission set is created, assign this permission set to the required user. For this POC, I have added a permission set to myself.

4. Create Named Credential

Create a named credential with the name Jira NC (JiraNC) and the below properties.

Allow Calloutchecked
External CredentialAbove created External Credential Jira External Credential EC 
Generate Authorization HeaderChecked
Allow Formulas in HTTP HeaderChecked
Allow Formulas in HTTP Body
Named Credential-Salesforcecodex

5. Update External Credential Basic authentication

Once parameters are created in the named principal, we can use these parameters to generate an authentication token. We need to create a custom header Authorization in this external credential.

Value for external header will be – {!’Basic ‘ & BASE64ENCODE(BLOB($Credential.JiraExternalCredentialEC.Username & ‘:’ & $Credential.JiraExternalCredentialEC.Password))}

External Credential Basic authentication | SalesforceCodex

JiraExternalCredentialEC is the external credential name and Username and Password are named principal parameters. So if you have added different names for these parameters then put names accordingly.

6. Create HTTP Callout Action and Test Endpoint Connection

Let us create an HTTP Callout action to connect JIRA. Create a screen flow and add an Action element on the screen. On the action page select HTTP Callout action to start External Service creation.

External Service | HTTP Callout | SalesforceCodex

We need to call the JIRA Issue API https://salesforcecodex.atlassian.net/rest/api/3/issue/10002 to get an issue created for any project. Once an external service is created, we need to create an invocable action to execute this API. Create a GET action to retrieve issue details.

External Service Action | HTTP Callout | SalesforceCodex

After invocable action is created, we will be redirected to the response generation/consumption page to create response classes.

Connection Verify | HTTP Callout|  SalesforceCodex

Select Connect for Schema to generate the response based on the URL. This will be only available for GET invocable action. If correct authentication is provided and the URL is correct then it will generate a proper response. This way we can test URLs while HTTP Callout configuration.

Schema Generation- SalesforceCodex

After the response is generated Save this action to use in Flow.


Verify Your API Connection via HTTP Callout

Related Posts

 Searching Text in Flow Data Table

Getting the current Record in Salesforce Flow

Show User Record Access Using Flow

 Data Table in Screen Flow

You may also like

Leave a Comment

Top 10 Salesforce Service Cloud Features Top 10 Best Practices for Lightning Flow Facts and Statistics for Salesforce’s Size and Market Share Top 5 Contract Management Salesforce Apps Top 10 Enterprise Integration Use Cases