Skip to content

API Fetcher

Fetches data from healthcare-focused APIs with optional presets for common FHIR and medical endpoints. Supports single-call or parallel batch execution, simple Bearer token authentication, automatic response format detection (JSON/XML/Text), and built-in retry with basic error handling.
Preview

Usage

Use this node to retrieve healthcare data from preset endpoints (e.g., FHIR Patients) or a custom URL. For a single call, select a preset or set a custom URL, optionally add an auth token and JSON query parameters, and run. For multiple calls, switch to parallel mode and provide batch requests as a JSON array; the node will execute them concurrently and aggregate the results.

Inputs

FieldRequiredTypeDescriptionExample
preset_endpointTrueCHOICESelect a predefined healthcare API endpoint or 'custom' to use your own URL.fhir_patients
api_urlTrueSTRINGFull API URL to fetch from. Only used when preset_endpoint is 'custom'.https://hapi.fhir.org/baseR4/Patient
execution_modeTrueCHOICESelect 'single' for one request or 'parallel' to execute multiple requests concurrently.single
max_workersFalseINTNumber of concurrent workers used in parallel execution.4
batch_requestsFalseSTRINGJSON array describing multiple requests for parallel mode. Each item supports 'url' and optional 'params' (JSON object as string). If a preset is selected (not 'custom'), the preset URL is used and 'url' in items is ignored.[{"url": "https://api.example.com/resource", "params": "{\"id\": \"123\"}"}, {"url": "https://api.example.com/other", "params": "{\"name\": \"John\"}"}]
auth_tokenFalseSTRINGAuthentication token included as a Bearer token in the Authorization header.
query_paramsFalseSTRINGQuery parameters as a JSON object string. Applied to the request URL. In parallel mode, each batch item can override with its own 'params'.{"name": "John", "_count": 10}
max_itemsFalseINTMaximum number of items to return when the API response is a JSON array (single mode only).10

Outputs

FieldTypeDescriptionExample
response_dataSTRINGProcessed response content as a string. JSON responses are pretty-printed; parallel mode returns a JSON stringified array of per-request results.[ "{\n \"id\": \"123\", ...\n}", "{\n \"id\": \"456\", ...\n}" ]
status_messageSTRINGHuman-readable status message summarizing the outcome (e.g., number of items fetched or parallel success/failure counts).Executed 2 requests in parallel. Success: 2, Failed: 0
successBOOLEANIndicates whether the request(s) succeeded. In parallel mode, true if at least one request succeeded.True
status_codeINTHTTP status code. In parallel mode, returns 200 for the aggregated result; individual request codes are not surfaced in this field.200
response_headersSTRINGResponse headers as a JSON string. In parallel mode, contains an 'execution_log' array with per-request logs.{"execution_log": ["Request 0: SUCCESS - Successfully fetched ...", "Request 1: SUCCESS - Successfully fetched ..."]}
response_timeFLOATTotal time taken to complete the operation in seconds.1.42

Important Notes

  • Presets available: fhir_patients, fhir_observations, fhir_medications, fhir_conditions, fhir_diagnostic_reports, covid_tracker, drug_interaction_checker, medical_codes_icd10, clinical_trials.
  • Custom URL usage: The api_url field is only used when preset_endpoint is 'custom'.
  • Auth handling: auth_token is sent as 'Authorization: Bearer '. Leave empty for public endpoints.
  • Query params format: query_params must be a JSON object string (e.g., "{\"name\": \"John\"}"). Invalid JSON is ignored.
  • Parallel mode input: batch_requests must be a JSON array. Each item supports 'url' and optional 'params' (as a JSON object string). If using a preset (not 'custom'), the preset URL is applied to all items and item 'url' values are ignored.
  • Item limiting: max_items only affects single mode when the response is a JSON array. In parallel mode, each response is processed with a high limit to preserve results.
  • Retries and timeouts: Each request uses up to 3 retries with exponential backoff and a 30s timeout. Network errors return status_code 0.
  • Response detection: The node auto-detects response format (JSON/XML/Text). Non-JSON content is returned as text.
  • Compliance reminder: Ensure proper authorization and handling when accessing patient data or regulated endpoints.

Troubleshooting

  • Invalid batch_requests JSON: Ensure batch_requests is valid JSON and an array. Example: "[{\"url\": \"https://...\", \"params\": \"{\\"id\\": \\"123\\"}\"}]".
  • Invalid query_params: Provide a JSON object string. If invalid, parameters are ignored and the base URL is used.
  • 401/403 errors: Verify auth_token is present and valid for protected endpoints.
  • Status code 0 and errors: Indicates network/transport errors or timeouts. Check connectivity, endpoint availability, and consider reducing max_workers or request volume.
  • Parallel mode does nothing: Ensure execution_mode is 'parallel' and batch_requests is non-empty and valid JSON.
  • Unexpected data format: If the response is not valid JSON, it will be returned as text. Check endpoint and parameters.
  • Preset vs. custom confusion: When using a preset (not 'custom'), api_url and batch item 'url' values are ignored; only the preset URL is used.