Skip to content

API Fetcher

Fetches data from healthcare-related APIs with optional presets for common FHIR and medical endpoints. Supports single or parallel request execution, simple bearer-token authentication, automatic response format detection (JSON/XML/text), basic retries, and status reporting.
Preview

Usage

Use this node to retrieve data from healthcare APIs in either single-request or batch/parallel mode. Select a preset endpoint for common resources (e.g., FHIR Patients), or choose custom to provide your own URL. Optionally add a bearer token and query parameters. In parallel mode, provide a JSON array of request configs to fan out multiple GET requests concurrently and aggregate the results.

Inputs

FieldRequiredTypeDescriptionExample
preset_endpointTrueCHOICESelect a predefined healthcare API endpoint or 'custom' to use your own API URL.fhir_patients
api_urlTrueSTRINGThe API URL to fetch data from. Used only when preset_endpoint is 'custom'.https://hapi.fhir.org/baseR4/Patient
execution_modeTrueCHOICEChoose 'single' for one request or 'parallel' to execute multiple requests concurrently.single
max_workersFalseINTNumber of concurrent workers when execution_mode is 'parallel'.4
batch_requestsFalseSTRINGA JSON array describing multiple GET requests for parallel mode. Each item may contain 'url' and optional 'params' (JSON string of query parameters).[{"url": "https://hapi.fhir.org/baseR4/Patient", "params": "{\"_count\": 5}"}, {"url": "https://api.covidtracking.com/v1/us/current.json"}]
auth_tokenFalseSTRINGBearer token for Authorization header. Leave empty if not required by the API.
query_paramsFalseSTRINGQuery parameters as a JSON object string. Applied to the request URL. In parallel mode, per-request 'params' in batch_requests take precedence.{"name": "John", "_count": 10}
max_itemsFalseINTMaximum number of items to keep when the response is a JSON array (single mode).10

Outputs

FieldTypeDescriptionExample
response_dataSTRINGThe fetched and processed response data as a string. For JSON responses, formatted JSON is returned. In parallel mode, this is a JSON array of each request’s processed data.{"resourceType": "Bundle", "entry": [...]}
status_messageSTRINGHuman-readable summary of the operation, including success counts in parallel mode.Successfully fetched 10 items from API
successBOOLEANIndicates if the operation succeeded. In parallel mode, true if at least one request succeeded.True
status_codeINTHTTP status code for single requests. In parallel mode, returns 200 for the aggregated result.200
response_headersSTRINGResponse headers as a JSON string. In parallel mode, contains an 'execution_log' array with per-request outcomes.{"Content-Type": "application/fhir+json"}
response_timeFLOATTotal elapsed time in seconds for the operation.1.42

Important Notes

  • Preset endpoints include: fhir_patients, fhir_observations, fhir_medications, fhir_conditions, fhir_diagnostic_reports, covid_tracker, drug_interaction_checker, medical_codes_icd10, clinical_trials.
  • api_url is only used when preset_endpoint is 'custom'.
  • Only GET requests are supported in this simplified interface; use batch_requests for multiple GETs in parallel.
  • Response format is auto-detected (JSON/XML/text). JSON arrays are truncated to max_items in single mode.
  • Parallel mode aggregates results and sets success to true if any request succeeds; status_code is set to 200 for the aggregate.
  • Default timeout per request is approximately 30 seconds with basic retry logic (up to 3 attempts).
  • query_params and per-item 'params' in batch_requests must be valid JSON object strings (e.g., "{\"_count\": 10}").
  • For protected APIs, provide auth_token as a bearer token. Never embed secrets directly in flows that may be shared.
  • When handling patient or clinical data, ensure appropriate compliance and safeguards.

Troubleshooting

  • Invalid batch_requests: Ensure it is a JSON array string. Example: "[{\"url\": \"https://...\"}]".
  • Invalid query_params or params: Provide a valid JSON object string (e.g., "{\"_count\": 10}"), not URL-encoded or Python dict syntax.
  • Authentication errors (401/403): Verify auth_token, endpoint requirements, and scopes. Some endpoints may not require authentication.
  • Timeouts: Large responses or slow endpoints can exceed ~30s per request. Reduce max_items, narrow query parameters, or decrease batch size.
  • Unexpected response format: If non-JSON is returned, the node outputs raw text or XML. Verify endpoint and parameters.
  • Empty or partial results in parallel mode: Check the execution_log in response_headers for per-request messages and errors.
  • Custom URL ignored: This occurs if preset_endpoint is not 'custom'. Set preset_endpoint='custom' to use api_url.