Skip to content

API Fetcher

Fetches data from healthcare-related APIs with optional presets and simple auth. Supports single GET requests or parallel batches, auto-detects response format, limits JSON list size, and includes retry and timeout handling.
Preview

Usage

Use this node to retrieve healthcare data such as FHIR resources or clinical datasets. Choose a preset for common endpoints or provide a custom URL. For multiple calls, switch to parallel mode and supply a JSON array of request configs; the node aggregates responses and provides an execution log.

Inputs

FieldRequiredTypeDescriptionExample
preset_endpointTrueenum ['custom', 'fhir_patients', 'fhir_observations', 'fhir_medications', 'fhir_conditions', 'fhir_diagnostic_reports', 'covid_tracker', 'drug_interaction_checker', 'medical_codes_icd10', 'clinical_trials']Selects a predefined healthcare API endpoint or 'custom' to use your own URL.fhir_patients
api_urlTrueSTRINGFull API URL used when preset_endpoint is 'custom'. Ignored when a preset is selected.https://hapi.fhir.org/baseR4/Patient
execution_modeTrueenum ['single', 'parallel']Single request or parallel batch execution.single
max_workersFalseINTConcurrent worker count for parallel execution.4
batch_requestsFalseSTRINGJSON array of request configs for parallel execution. Each item may include 'url' and 'params' (JSON string).[{"url": "https://hapi.fhir.org/baseR4/Patient", "params": "{\"name\": \"Smith\"}"}, {"url": "https://api.covidtracking.com/v1/us/current.json"}]
auth_tokenFalseSTRINGAuthentication token sent as Bearer Authorization header.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
query_paramsFalseSTRINGJSON object string of query parameters appended to the URL.{"name": "John", "_count": 10}
max_itemsFalseINTMaximum number of items to retain from JSON list responses (single mode).10

Outputs

FieldTypeDescriptionExample
response_dataSTRINGFetched data as a string. JSON responses are pretty-printed and may be truncated to max_items; parallel mode returns a JSON array of per-request results.{"resourceType": "Bundle", ...}
status_messageSTRINGHuman-readable outcome summary for the request(s).Successfully fetched 10 items from API
successBOOLEANTrue if the request succeeded (parallel: true if at least one request succeeded).True
status_codeINTHTTP status code for single requests; in parallel mode, returns 200 for the aggregated operation.200
response_headersSTRINGJSON string of response headers (single). In parallel mode, contains a JSON object with 'execution_log'.{"Content-Type": "application/json", ...}
response_timeFLOATTotal elapsed time in seconds for the operation.1.42

Important Notes

  • When preset_endpoint is not 'custom', the preset URL is used and the 'api_url' field is ignored.
  • Only GET requests are supported via the main function. For parallel mode, each request uses GET.
  • In parallel mode with a preset selected, the preset URL is applied to all batch items, ignoring each item's 'url'. Use 'custom' to honor per-item URLs.
  • query_params must be a valid JSON object string; invalid JSON is ignored with a warning.
  • batch_requests must be a valid JSON array string; invalid JSON fails the node with an error message.
  • JSON list responses in single mode are truncated to 'max_items'. In parallel mode, an internal high limit is used per response.
  • Retries with exponential backoff are applied (default 3 attempts, ~30s timeout per request).
  • Authentication is simplified to a single Bearer token via 'auth_token' header.
  • response_headers is serialized to a JSON string; in parallel mode it contains {"execution_log": [...]} rather than real response headers.
  • success is true if the HTTP request(s) completed successfully; network or server errors return success=false and status_code=0 (single).

Troubleshooting

  • Invalid batch_requests JSON: Ensure the value is a JSON array string like [{"url": "https://...", "params": "{...}"}].
  • Invalid query_params JSON: Provide a JSON object string (e.g., "{\"name\": \"John\"}").
  • 401/403 Unauthorized: Verify 'auth_token' is correct and required by the endpoint.
  • Timeout errors: Increase reliability by reducing batch size, increasing 'max_workers' sensibly, or trying again later. Default per-request timeout is about 30 seconds.
  • Preset vs URL mismatch: If using a preset, the node ignores 'api_url' and (in parallel) each item's 'url'. Set preset_endpoint='custom' to use custom URLs.
  • Empty response_data with error message: Check 'status_message' for details (e.g., network errors, invalid endpoint, or server errors).
  • Unexpected response format: The node auto-detects format; if JSON parsing fails, data is returned as text and the status message will indicate formatting issues.