invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

HTTPGET_TEXT

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> HTTPGET_TEXT[HTTPGET_TEXT]:::quoted
    HTTPGET_TEXT --> End((END))

Purpose

The HTTPGET_TEXT SQL function retrieve the HTTP response on a GET from a URL as a text (varchar2).

The URL must be accessible. Use the NativePlatformScalarRequest view on cloud applications to directly access their APIs with credentials and rate limiters.

See also HTTPGET and HTTPPOST.

Parameters:

  • URL (varchar2): the URL to GET the data from.
  • Encoding (optional, varchar2): the encoding from the data to receive as described in Character Set Encoding. Defaults to UTF8.
  • Time-out (optional, int64): the number of milliseconds to wait for the counterparty to answer. Defaults to 30 000.
  • Ignore web error (optional, boolean): whether a failed retrieval returns null instead of terminating the statement. Defaults to false.

Returns: the collected data as varchar2.

Every attempt is registered in Invantive-HTTPDOWNLOADHISTORY with its HTTP status code and error message, whether it succeeded, failed or was ignored. That is where the reason for a null is found when ignore web error is set.

Examples

The following example retrieves the text from the HTTP response on https://cloud.invantive.com as UTF8:

select httpget_text('https://cloud.invantive.com')

----------------
<!DOCTYPE html>

The following example retrieves the text from the HTTP response on https://cloud.invantive.com as EBCDIC (Spain-Euro):

select httpget_text('https://cloud.invantive.com', 'IBM01145')

----------------
à|äèß&á€ÇÈ_%ž