ComfyUI > Nodes > ComfyUI_API_Manager > API Request Node

ComfyUI Node: API Request Node

Class Name

APIRequestNode

Category
API Manager
Author
CC-BryanOttho (Account age: 808days)
Extension
ComfyUI_API_Manager
Latest Updated
2024-06-14
Github Stars
0.02K

How to Install ComfyUI_API_Manager

Install this extension via the ComfyUI Manager by searching for ComfyUI_API_Manager
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_API_Manager in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

API Request Node Description

Facilitates API interactions, automates data retrieval, simplifies communication, handles authentication and response processing efficiently.

API Request Node:

The APIRequestNode is a versatile tool designed to facilitate seamless API interactions within your workflow. Its primary purpose is to make API requests and process the responses, allowing you to integrate external data sources or services into your projects. This node is particularly beneficial for automating tasks that require data retrieval from APIs, such as fetching real-time information or interacting with web services. By providing a structured way to handle authentication, request execution, and response processing, the APIRequestNode simplifies the complexities of API communication, making it accessible even to those with limited technical expertise. Its ability to handle authentication and extract specific data from API responses ensures that you can efficiently incorporate external data into your creative processes.

API Request Node Input Parameters:

api_url

The api_url parameter specifies the endpoint of the API you wish to interact with. It is a string input where you provide the URL of the API service. This parameter is crucial as it determines the target of your API request. The default value is an empty string, and you should replace it with the actual URL of the API you intend to use.

auth_url

The auth_url parameter is used when the API requires authentication. It is a string input where you provide the URL for the authentication service. This parameter is essential for obtaining an access token if the API requires one. The default value is an empty string, and it should be set to the authentication endpoint if needed.

token_attribute_name

The token_attribute_name parameter defines the name of the attribute in the authentication response that contains the access token. It is a string input and is necessary for extracting the token from the authentication response. The default value is an empty string, and you should specify the correct attribute name to ensure successful token retrieval.

auth_body_text

The auth_body_text parameter allows you to provide the body of the authentication request in JSON format. It is a multiline string input, enabling you to include complex JSON structures if required by the authentication process. This parameter is important for APIs that require specific data in the authentication request body.

array_path

The array_path parameter specifies the path to the array within the API response from which you want to extract data. It is a string input that helps navigate the JSON structure of the response. The default value is an empty string, and you should provide the correct path to access the desired data array.

iteration_index

The iteration_index parameter is an integer input that determines which item from the array specified by array_path should be selected. It allows you to iterate over the array and choose a specific element. The default value is 0, with a minimum of 0 and a maximum of 9999, providing flexibility in selecting items from large arrays.

API Request Node Output Parameters:

API_RESPONSE

The API_RESPONSE output provides the data extracted from the API response based on the specified array_path and iteration_index. It is typically a JSON object or a specific item from an array, depending on the response structure. This output is crucial for accessing the information retrieved from the API.

LENGTH

The LENGTH output indicates the number of items in the array specified by array_path. It is an integer value that helps you understand the size of the data set returned by the API. This output is useful for validating the response and ensuring that the expected data is available.

API_KEY

The API_KEY output contains the authentication token used in the API request, formatted as a Bearer token. It is a string output that confirms successful authentication and can be used for subsequent requests if needed. This output is important for maintaining secure and authenticated API interactions.

API Request Node Usage Tips:

  • Ensure that the api_url and auth_url are correctly set to the endpoints provided by the API service you are using to avoid connection issues.
  • Use the auth_body_text parameter to provide any necessary authentication details in JSON format, ensuring that the structure matches the API's requirements.
  • When working with large arrays, use the iteration_index parameter to efficiently select specific items without processing the entire array.

API Request Node Common Errors and Solutions:

Error parsing JSON input

  • Explanation: This error occurs when the auth_body_text is not formatted correctly as JSON.
  • Solution: Double-check the JSON structure in auth_body_text for syntax errors, such as missing commas or brackets, and ensure it is valid JSON.

Authentication failed

  • Explanation: This error indicates that the authentication process was unsuccessful, possibly due to incorrect auth_url, token_attribute_name, or auth_body_text.
  • Solution: Verify that the auth_url is correct, the token_attribute_name matches the API's response attribute, and the auth_body_text contains the correct authentication details.

Index out of range

  • Explanation: This error occurs when the iteration_index exceeds the number of items in the array specified by array_path.
  • Solution: Check the LENGTH output to ensure the iteration_index is within the valid range of the array's size. Adjust the index accordingly.

API Request Node Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_API_Manager
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.