Create an HTTP GET request returning the request's id
Note
HTTP requests are not started until the transaction is committed
signature
1 2 3 4 5 6 7 8 9101112131415161718
net.http_get(-- url for the requesturltext,-- key/value pairs to be url encoded and appended to the `url`paramsjsonbdefault'{}'::jsonb,-- key/values to be included in request headersheadersjsonbdefault'{}'::jsonb,-- WARNING: this is currently ignored, so there is no timeout-- the maximum number of milliseconds the request may take before being cancelledtimeout_millisecondsintdefault1000)-- request_id referencereturnsbigintstrictvolatileparallelsafelanguageplpgsql
Create an HTTP POST request with a JSON body, returning the request's id
Note
HTTP requests are not started until the transaction is committed
Note
the body's character set encoding matches the database's server_encoding setting
signature
1 2 3 4 5 6 7 8 910111213141516171819
net.http_post(-- url for the requesturltext,-- body of the POST requestbodyjsonbdefault'{}'::jsonb,-- key/value pairs to be url encoded and appended to the `url`paramsjsonbdefault'{}'::jsonb,-- key/values to be included in request headersheadersjsonbdefault'{"Content-Type": "application/json"}'::jsonb,-- WARNING: this is currently ignored, so there is no timeout-- the maximum number of milliseconds the request may take before being cancelledtimeout_millisecondsintdefault1000)-- request_id referencereturnsbigintvolatileparallelsafelanguageplpgsql
Given a request_id reference, retrieve the response.
When async:=false is set it is recommended that statement_timeout is set for the maximum amount of time the caller is willing to wait in case the response is slow to populate.
Warning
net.http_collect_response must be in a separate transaction from the calls to net.http_<method>
signature
1 2 3 4 5 6 7 8 9101112
net.http_collect_response(-- request_id referencerequest_idbigint,-- when `true`, return immediately. when `false` wait for the request to complete before returningasyncbooldefaulttrue)-- http response composite wrapped in a result typereturnsnet.http_response_resultstrictvolatileparallelsafe