SOURCE_HTTP()
All functions > SOURCE > SOURCE_HTTP()
Creates a HTTP connection to the given URI
Signatures
Returns: HTTP source connection for online API calls
SOURCE_HTTP( uri [ WITH ( property = value, ... ) ] ) → HTTPSOURCE
| Parameter | Type | Required | Description |
|---|---|---|---|
uri | VARCHAR | Yes | Base URI for requests, such as 'https://api.example.com' |
method | VARCHAR | No | WITH property: HTTP method ('GET', 'POST'...) |
path | VARCHAR | No | WITH property: path appended to the base URI |
headers | ROW | No | WITH property: HTTP headers, as a ROW |
query_params | ROW | No | WITH property: query string parameters, as a ROW |
body | ROW | No | WITH property: JSON request body, as a ROW |
timeout | DECIMAL | No | WITH property: request timeout, such as '500ms' |
batch | ROW | No | WITH property: several rows per call, as ROW(size, request_field, response_field). The rows' JSON bodies go in one array under request_field (default 'instances'; '': the body is the bare array) and the answer holds one result per row, in the same order, in the array at response_field (default 'predictions', a dotted path; '': the answer is the bare array) |
Notes
- Creates HTTP connection for real-time API feature enrichment
- Supports RESTful API calls with full control over HTTP parameters
- Connection config reused across requests
- Online-only restriction (for real-time serving)
- Used with EXTERNAL_HTTP to make actual API calls
- Supports GET, POST, PUT, DELETE, PATCH methods
- Returns JSON responses parsed as feature values
Availability
| Status | Backends |
|---|---|
| Available | serving |
See also
Examples
Persist an HTTP source
FeatureQL
CREATE OR REPLACE FEATURE FM.TUTORIALS.EXTERNAL_HTTP.HTTP_SOURCE AS
SOURCE_HTTP(
'http://host.docker.internal:18010/hello'
WITH (
query_params=ROW('default' AS "name"),
timeout='500ms'
)
);Result
| feature_name VARCHAR | status VARCHAR | message VARCHAR |
|---|---|---|
| FM.TUTORIALS.EXTERNAL_HTTP.HTTP_SOURCE | CREATED | Feature created as not exists |