EXTERNAL_HTTP()
All functions > SOURCE > EXTERNAL_HTTP()
Returns the JSON response from a HTTP call
Signatures
Returns: Parsed JSON response from HTTP API in [value], plus source_status on serving
EXTERNAL_HTTP( FROM source [ WITH ( property = value, ... ) ] ) → ROW(value JSON)
| Parameter | Type | Required | Description |
|---|---|---|---|
source | HTTPSOURCE | Yes | Connection feature defined with SOURCE_HTTP() |
method | VARCHAR | No | WITH property: HTTP method override |
path | VARCHAR | No | WITH property: path override or extension |
headers | ROW | No | WITH property: headers override or extension |
query_params | ROW | No | WITH property: query parameters override or extension |
body | ROW | No | WITH property: request body override |
timeout | DECIMAL | No | WITH property: timeout override |
Notes
- Makes HTTP API call and returns JSON response
WITHproperties override theSOURCE_HTTP()defaults- Supports dynamic request parameters per query
- Returns
ROW(value JSON): read the response with[value] - The row also has
source_status(OK,MISS,TIMEOUT,UNAVAILABLE,ERROR) on serving: reading it guards the call (on a failed request the value is NULL, the status says why, the call succeeds); unguarded, a failed request fails the call - Common use cases: fraud detection APIs, ML model APIs, enrichment services
- Handles request retries and error responses
- Online-only restriction (for real-time serving)
See also
Examples
Call an API per key and parse the JSON response
FeatureQL
DEFINE
firstname := INPUT(VARCHAR)
RETURN
firstname,
http_response := EXTERNAL_HTTP(
FROM fm.tutorials.external_http.http_source
WITH (
QUERY_PARAMS = ROW(firstname AS name)
)
)[value]
FOR
firstname := BIND_VALUES(ARRAY('Alice', 'Bob', 'Charlie'))
;Result
| FIRSTNAME VARCHAR | HTTP_RESPONSE VARCHAR |
|---|---|
| Alice | Hello Alice! |
| Bob | Hello Bob! |
| Charlie | Hello Charlie! |