API
Configuring Authorization in the Generic API Node
The Generic API Node in Integrail’s Agent Studio lets you connect to external APIs and retrieve data as part of your workflow.
Step 1: Accessing the Generic API Node Settings
Open the workflow in Agent Studio where your Generic API Node is placed.
Select the Generic API Node and click on Settings to open the configuration panel where headers and authentication details can be added.
Step 2: Common Authorization Methods and Examples
A. Bearer Token (OAuth 2.0)
Bearer tokens are widely used for secure API access via OAuth 2.0.
Use Case: When the API requires a token-based authorization.
Example Configuration:
HTTP Method: Select the appropriate method (e.g., GET, POST).
URL: Enter the API endpoint, e.g.,
https://api.example.com/user/profile.Settings:
Click on Settings at the bottom of the node.
Add String.
Click Save on the pop-up.
In the new string field, that appeared on the sidebar Settings enter:
Authorization: Bearer YOUR_ACCESS_TOKENReplace
YOUR_ACCESS_TOKENwith your actual token (e.g.,Bearer abcdef1234567890).
B. Basic Authentication
Basic Authentication is used for APIs that require a username and password encoded in Base64.
Use Case: When the API requires a username and password for authorization.
Example Configuration:
HTTP Method: Select POST (or as required by the API).
URL: Enter the API endpoint.
Encode Credentials: Combine
username:passwordand encode in Base64.For example,
user:passbecomesdXNlcjpwYXNz.
Settings:
Click on Settings at the bottom of the node.
Add String.
Click Save on the pop-up.
In the new string field, that appeared on the sidebar Settings enter:
Replace
YOUR_ACCESS_TOKENwith your actual token (e.g.,Bearer abcdef1234567890).
C. API Key in Headers
Some APIs use an API key provided by the service, added to the request headers.
Use Case: When the API requires an API key for access, specified in the headers.
Example Configuration:
HTTP Method: Select GET (or as required).
URL: Enter the API endpoint, e.g.,
https://api.example.com/data.Settings:
Click on Settings at the bottom of the node.
Add String.
Click Save on the pop-up.
In the new string field, that appeared on the sidebar Settings enter:
Replace
YOUR_ACCESS_TOKENwith your actual token (e.g.,Bearer abcdef1234567890).
D. API Key in URL (Query Parameter)
Some APIs require the API key as a query parameter in the URL itself.
Use Case: When the API expects the API key as a URL parameter.
Example Configuration:
HTTP Method: Select GET.
URL: Enter the endpoint with the API key as a query parameter, e.g.,
https://api.example.com/data?api_key=your_api_key_here.
Step 3: Adding Additional Headers
Some APIs may require additional headers, such as Content-Type and Accept.
Content-Type: Specifies the format of data in the request body (e.g.,
application/json).Accept: Informs the server of the expected response format (e.g.,
application/json).
Summary Table of Common Authorization Methods
Bearer Token
GET/POST
https://api.example.com/data
Authorization
Bearer YOUR_ACCESS_TOKEN
Basic Authentication
POST
https://api.example.com/auth
Authorization
Basic YOUR_BASE64_CREDENTIALS
API Key (Header)
GET
https://api.example.com/data
x-api-key
your_api_key_here
API Key (Query)
GET
https://api.example.com/data?...
Query Parameter
Append ?api_key=your_api_key_here
We’d love to hear from you! Reach out to [email protected]
Last updated