API call
Function: API call
Effortlessly connect and retrieve data from external systems through their APIs, simplifying data integration and enhancing the functionality of your applications. This action provides a user-friendly, code-free interface to interact with any REST API that returns JSON or text data.
Input
- Authentication method: Choose how you want to prove your identity to the API.
- Basic authentication: A simple method where you provide a username and password.
- Bearer Token: A security token passed in the request header.
- API Token: A specific token for API access, also passed in the request header.
- OAuth 1.0: A more complex authorization standard using signed requests.
- None: No authentication is used (for public APIs).
- Default Value:
None
- Username: (Only visible if "Basic authentication" is selected) The username for basic authentication.
- Password: (Only visible if "Basic authentication" is selected) The password for basic authentication.
- Consumer Key: (Only visible if "OAuth 1.0" is selected) The public identifier for your OAuth 1.0 client.
- Consumer Secret: (Only visible if "OAuth 1.0" is selected) The private key associated with your Consumer Key.
- Token ID: (Only visible if "OAuth 1.0" is selected) The access token for OAuth 1.0 requests.
- Token Secret: (Only visible if "OAuth 1.0" is selected) The secret associated with the access token.
- Realm: (Only visible if "OAuth 1.0" is selected) An optional identifier for the OAuth 1.0 credentials.
- Read timeout: The maximum time (in milliseconds) the system will wait for the entire response message to be received.
- Connect timeout: The maximum time (in milliseconds) the system will wait to establish a connection with the API.
- Token: (Only visible if "Bearer Token" or "API Token" is selected) The token used for Bearer or API Token authentication.
- Headers: Custom key-value pairs to include in the API request header (e.g.,
Content-Type: application/json). - Endpoint: The complete URL of the API you want to call (e.g.,
https://api.example.com/data). This is a required input. - Query parameters: Key-value pairs to add to the URL as query strings (e.g.,
?id=123&status=active). - Method: The HTTP method to use for the API call.
- GET: Retrieve data.
- PUT: Update existing data.
- POST: Create new data.
- DELETE: Remove data.
- PATCH: Partially update data.
- Default Value:
GET
- Request body: (Only visible if "POST", "PUT", or "PATCH" is selected) The data you want to send with your request, typically as a JSON object.
- Response type: The format you expect the API to return.
- JSON: Structured data in JSON format.
- Text: Plain text.
- List: A list of items.
- Default Value:
JSON
Output
- Response: The name of the variable where the retrieved data from the API will be stored.
- Default Value:
RESPONSE
- Default Value:
- Response format: Defines the structure or schema of the data returned by the API.
- Status: The name of the variable that will hold the outcome of the API call. Possible values include:
SUCCESS: The API call was successful.BAD_REQUEST: Your request was incorrectly formatted.UNAUTHORIZED: The authentication credentials provided were invalid or insufficient.NOT_FOUND: The specified API endpoint could not be found.READ_TIMEOUT: The connection timed out while waiting for the API to send its response.CONNECT_TIMEOUT: The connection timed out while trying to establish a link with the API.- Default Value:
STATUS
Execution Flow
Real-Life Examples
Example 1: Fetching Product Details from an E-commerce API
Imagine you want to display product information from an external e-commerce platform on your application.
- Inputs:
- Authentication method:
None(assuming the product catalog is public) - Endpoint:
https://api.example-shop.com/products/12345 - Method:
GET - Response type:
JSON - Response:
ProductDetails - Status:
API_Call_Status
- Authentication method:
- Result: The
ProductDetailsvariable will contain a JSON object with information about product ID12345(e.g., name, price, description). TheAPI_Call_Statusvariable will be set toSUCCESS.
Example 2: Submitting a New Customer Order
You need to send new order details from your application to a fulfillment service.
- Inputs:
- Authentication method:
Bearer Token - Token:
your_secure_bearer_token_123 - Endpoint:
https://api.fulfillment-service.com/orders - Method:
POST - Headers:
\{
"Content-Type": "application/json"
\} - Request body:
\{
"customerName": "Jane Doe",
"items": [
\{"productId": "P001", "quantity": 2\},
\{"productId": "P005", "quantity": 1\}
],
"shippingAddress": "123 Main St, Anytown"
\} - Response type:
JSON - Response:
OrderConfirmation - Status:
Order_Submission_Status
- Authentication method:
- Result: A new order will be created in the fulfillment service. The
OrderConfirmationvariable will contain the API's response, likely including an order ID and status. TheOrder_Submission_Statusvariable will be set toSUCCESS.
Example 3: Updating User Profile Information
You want to allow users to update their profile details in an external CRM system.
- Inputs:
- Authentication method:
Basic authentication - Username:
crm_user - Password:
crm_password_secure - Endpoint:
https://api.crm-system.com/users/john.doe - Method:
PUT - Headers:
\{
"Content-Type": "application/json"
\} - Request body:
\{
"email": "[email protected]",
"phone": "555-123-4567"
\} - Response type:
JSON - Response:
UserProfileUpdate - Status:
Profile_Update_Status
- Authentication method:
- Result: John Doe's email and phone number will be updated in the CRM system. The
UserProfileUpdatevariable will hold the API's confirmation of the update. TheProfile_Update_Statusvariable will be set toSUCCESS. If the username or password were incorrect,Profile_Update_Statuswould beUNAUTHORIZED.