Ask AI
Skip to main content

httpcall

Function: API call

This function allows your application to connect with external web services (APIs) to send or receive data. It simplifies the process of integrating with other systems, enabling your application to fetch information, submit data, or trigger actions on external platforms without writing any code. You can use it to interact with any standard REST API that returns data in JSON or plain text format.

Input

  • Authentication method (Dropdown): Specifies how your application will prove its identity to the external service.
    • Basic authentication: Requires a username and password.
    • Bearer Token: Uses a special token for authentication.
    • API Token: Uses an API key for authentication.
    • None: No authentication is used.
    • Required. Default: None.
  • Username (Text): Your username for Basic authentication. (Only visible if "Basic authentication" is selected).
  • Password (Password): Your password for Basic authentication. (Only visible if "Basic authentication" is selected).
  • Read timeout (Number): The maximum time (in milliseconds) the system will wait to receive the entire response from the API.
  • Connect timeout (Number): The maximum time (in milliseconds) the system will wait to establish a connection with the API.
  • Token (Password): Your Bearer Token or API Key. (Only visible if "Bearer Token" or "API Token" is selected).
  • Headers (Key/Value Pairs): Custom information sent with your request, such as content type or specific API keys not handled by the authentication method.
  • Endpoint (Text): The full web address (URL) of the specific API resource you want to interact with.
    • Required.
  • Query parameters (Key/Value Pairs): Additional pieces of information added to the end of the Endpoint URL, often used for filtering or sorting data.
  • Method (Dropdown): The type of action you want to perform on the API resource.
    • GET: Retrieve data.
    • PUT: Update an existing resource entirely.
    • POST: Create a new resource.
    • DELETE: Remove a resource.
    • PATCH: Partially update an existing resource.
    • Required. Default: GET.
  • Request body (Key/Value Pairs): The data you want to send to the API, typically used when creating or updating resources. (Only visible if "POST", "PUT", or "PATCH" method is selected).
  • Response type (Dropdown): The format you expect the API to return its data in.
    • JSON: Structured data (like a collection of key-value pairs or a list of items).
    • Text: Plain text.
    • List: A list of items.
    • Required. Default: JSON.

Output

  • Response (Variable): The name of the variable where the data received from the API call will be stored.
  • Response format (Data Format): Helps your application understand the structure of the data received from the API, so it can be used correctly.
  • Status (Status): The name of the variable where the outcome of the API call will be stored. Possible values include:
    • SUCCESS: The API call was successful.
    • BAD_REQUEST: The request sent to the API was invalid.
    • UNAUTHORIZED: Your authentication credentials were not accepted.
    • NOT_FOUND: The specified endpoint or resource could not be found on the external service.
    • READ_TIMEOUT: The API took too long to send a response.
    • CONNECT_TIMEOUT: The application took too long to establish a connection with the API.

Execution Flow

Real-Life Examples

  1. Fetching Customer Details from a CRM System

    • Scenario: Your application needs to display details of a specific customer from an external Customer Relationship Management (CRM) system.
    • Inputs:
      • Authentication method: Bearer Token
      • Token: your_crm_api_token_123
      • Endpoint: https://api.crmsystem.com/v1/customers
      • Query parameters: id: 45678
      • Method: GET
      • Response type: JSON
      • Response: CustomerData
      • Status: CRMStatus
    • Result: The application successfully retrieves the customer's information (e.g., name, email, address) from the CRM. This data is stored as a structured object in the CustomerData variable. The CRMStatus variable will be set to SUCCESS.
  2. Submitting a New Order to an E-commerce Platform

    • Scenario: After a user completes a purchase in your application, you need to create a new order record in an external e-commerce platform.
    • Inputs:
      • Authentication method: Basic authentication
      • Username: store_admin
      • Password: secure_password_123
      • Endpoint: https://api.ecommerceplatform.com/orders
      • Method: POST
      • Request body:
        • customer_id: 101
        • items: [\{product_id: 500, quantity: 1\}, \{product_id: 501, quantity: 2\}]
        • total_amount: 150.00
      • Response type: JSON
      • Response: NewOrderConfirmation
      • Status: OrderStatus
    • Result: A new order is successfully created in the e-commerce platform. The NewOrderConfirmation variable will contain details like the new order ID and confirmation message. The OrderStatus variable will be set to SUCCESS.
  3. Checking Weather Forecast for a City

    • Scenario: Your application displays local weather information, and you need to fetch the current weather forecast for a specific city from a public weather API.
    • Inputs:
      • Authentication method: None
      • Endpoint: https://api.weatherapi.com/v1/current.json
      • Query parameters:
        • key: your_public_weather_api_key
        • q: London
      • Method: GET
      • Response type: JSON
      • Response: WeatherData
      • Status: WeatherAPIStatus
    • Result: The application retrieves the current weather conditions for London (e.g., temperature, humidity, description). This data is stored in the WeatherData variable, and the WeatherAPIStatus variable will be set to SUCCESS.