Skip to content

API Fetcher

Fetches data from healthcare-focused APIs with optional presets for common FHIR and medical endpoints. Supports single or parallel requests, simple Bearer token authentication, automatic response format detection (JSON/XML/text), and basic retry handling. Returns response data, status information, headers, and timing metrics.
Preview

Usage

Use this node to retrieve healthcare data (e.g., FHIR resources or clinical trial data) either as a one-off request or as multiple requests executed in parallel. Select a preset endpoint or provide a custom URL, optionally add an auth token and JSON-formatted query parameters, and set max items to limit large JSON arrays. In parallel mode, supply a JSON array of request configs to fan out multiple calls and aggregate results.

Inputs

FieldRequiredTypeDescriptionExample
preset_endpointTrueCHOICESelect a preconfigured healthcare API or choose 'custom' to use your own URL. Presets include: fhir_patients, fhir_observations, fhir_medications, fhir_conditions, fhir_diagnostic_reports, covid_tracker, drug_interaction_checker, medical_codes_icd10, clinical_trials.fhir_patients
api_urlTrueSTRINGThe API URL to fetch data from when 'preset_endpoint' is set to 'custom'. Ignored for non-custom presets.https://hapi.fhir.org/baseR4/Patient
execution_modeTrueCHOICEChoose 'single' for a single request or 'parallel' to execute multiple requests concurrently using 'batch_requests' and 'max_workers'.single
max_workersFalseINTNumber of concurrent workers for parallel execution. Used only when execution_mode is 'parallel'.4
batch_requestsFalseSTRINGJSON array describing multiple requests for parallel mode. Each item can include 'url' and optional 'params' (JSON object string). If a preset is selected (not 'custom'), 'url' can be omitted and the preset URL is used.[{"url": "https://hapi.fhir.org/baseR4/Patient", "params": "{\"_count\": 5}"}, {"url": "https://clinicaltrials.gov/api/v2/studies", "params": "{\"query\": \"diabetes\"}"}]
auth_tokenFalseSTRINGAuthentication token sent as a Bearer token in the Authorization header.
query_paramsFalseSTRINGJSON object string of query parameters merged into the request URL. Applies to single request mode and as default params for batch items that omit 'params'.{"_count": 10, "name": "John"}
max_itemsFalseINTMaximum number of items to return when the response body is a JSON array (single request mode only).10

Outputs

FieldTypeDescriptionExample
response_dataSTRINGThe fetched data as a string. Auto-formatted for JSON (pretty-printed), or raw text/XML depending on response.{ "resourceType": "Bundle", "entry": [ ... ] }
status_messageSTRINGHuman-readable status of the fetch, including item counts or errors.Successfully fetched 10 items from API
successBOOLEANIndicates whether the request(s) completed successfully.True
status_codeINTHTTP status code for the request. In parallel mode, returns 200 if at least one request succeeded.200
response_headersSTRINGResponse headers as a JSON string. In parallel mode, contains an execution log JSON object.{"content-type": "application/fhir+json;charset=utf-8"}
response_timeFLOATTotal elapsed time in seconds for the operation.0.84

Important Notes

  • Preset handling: If 'preset_endpoint' is not 'custom', the preset URL is used and 'api_url' is ignored.
  • Query parameters: 'query_params' must be a valid JSON object string (e.g., "{\"_count\": 10}"). Invalid JSON is ignored with a warning.
  • Authentication: 'auth_token' is included as 'Authorization: Bearer '. No other auth types are supported in this simplified interface.
  • Parallel mode inputs: 'batch_requests' must be a JSON array. Each item supports 'url' and 'params' (JSON object string).
  • Timeouts and retries: Each request uses a ~30s timeout and basic retry logic (up to 3 attempts) on transient errors.
  • Response processing: The node auto-detects response format. JSON arrays may be truncated to 'max_items' in single mode.
  • Headers output: For single requests, headers are returned as a JSON string. For parallel execution, 'response_headers' contains a JSON object with an 'execution_log' array.
  • Success in parallel: 'success' is true if at least one request succeeds; review the execution log for per-request outcomes.
  • HIPAA considerations: When fetching patient-related data, ensure appropriate authorization and compliant handling of sensitive information.

Troubleshooting

  • Invalid query_params: If query parameters are not valid JSON, they will be ignored. Provide a proper JSON object string (e.g., "{\"_count\": 10}").
  • Invalid batch_requests: Ensure 'batch_requests' is a JSON array string. Each element should include at least 'url' (for custom) or rely on a preset plus optional 'params'.
  • Unauthorized or 401/403: Verify 'auth_token' is correct and has necessary scopes. Place the literal token value in the field (e.g., "").
  • Timeouts: Large or slow endpoints may exceed the ~30s timeout. Reduce payload via query params, lower 'max_items', or split requests in parallel.
  • Mixed outcomes in parallel: If some requests fail, 'success' may still be true. Inspect 'response_headers' (execution_log) and individual result entries in 'response_data'.
  • Wrong endpoint used: When using a preset, 'api_url' is ignored. Set 'preset_endpoint' to 'custom' to use your custom URL.
  • Unexpected text/XML: If JSON is expected but the API returns text/XML, verify endpoint and headers. The node does not force content-type.