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
ParameterTypeRequiredDescription
uriVARCHARYesBase URI for requests, such as 'https://api.example.com'
methodVARCHARNoWITH property: HTTP method ('GET', 'POST'...)
pathVARCHARNoWITH property: path appended to the base URI
headersROWNoWITH property: HTTP headers, as a ROW
query_paramsROWNoWITH property: query string parameters, as a ROW
bodyROWNoWITH property: JSON request body, as a ROW
timeoutDECIMALNoWITH property: request timeout, such as '500ms'
batchROWNoWITH 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

StatusBackends
Availableserving

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 VARCHARstatus VARCHARmessage VARCHAR
FM.TUTORIALS.EXTERNAL_HTTP.HTTP_SOURCECREATEDFeature created as not exists