get_url_data_agg

GET_URL_DATA_AGG

Retrieve HTTP Response from URL.

  • Parameters:

    • p_JSON (List|str) – JSON Block - Red Line per Line

    • - JSON Parameters

      • EXA-CONNECTION: Exasol Connection

      • URL: URL - source of data

      • VERIFY: verify SSL Certificate

      • TOKENKEY: Tokenkey Authorization if not specified

      • TOKEN: Access Token

      • ERROR_JSON: JSON String in case an error has occurred

      • METHOD: http method (get, post, delete, put, patch)

      • ENCODING: Encoding (default utf8)

      • BODY: http body

      • HEADERS: http headers

      • RESULT: ALL|None to get all response results or just body

      • COOKIES: Cookies

      • RETRY_EXPRESSION: Expression if true no further retry is done

      • RETRY_SLEEP: Sleep in Seconds between retries

      • RETRY_MAX: Max Retries attempts. -1 for infinity

      • TIMEOUT: timeout=5 or (Connecting timeout, Reading timeout)

      • ALLOW_REDIRECTS: Allows redirects to be handled by http.

      • PROXIES*: Settings proxies {“protocol”: “schema://ip:port”}

      • CERT: Certificate path

      • FILES: Files

      • FILES_BASE64: Enable Base64 encoded input data

    • sortorder (int) – Sort order - Provide order get_url_data_agg(json_line, sid order by sid).

  • returns: str – JSON String

  • raises RequestException: In case of error.

Examples

Basic usage

1select get_url_data_agg('{"URL": "https://endoflife.date/api/v1/products/cert-manager"}', 1) a;

GIT Commit Example Build input json line per line (Files to be committed) and use it as input for get_url_data_agg:

 1with cte_view_text as (
 2      select rownum as sid, redsys.base64_encode(view_text) as view_text, view_name, view_schema
 3      from (select * from exa_dba_views where view_schema='TEST')
 4      order by false
 5)
 6select get_url_data_agg(json_line, sid order by sid) as jresult
 7from (
 8   select 0 as sid, '{"RESULT":"ALL","EXA-CONNECTION":"SXGIT_REST_API_HF", "URL":"/projects/1/repository/commits"}' as json_line
 9   union all
10   select 1 as sid, '{"branch": "main","commit_message":"test"}' as json_line
11);

Dataspot HTTP Multipart Forms

 1select '{'||max(case when sorder=99999998 then jsonbuffer else null end)||', "RESULT":'||redsys.get_url_data_agg(jsonbuffer, sorder order by sorder)||'}' as rest_result
 2from (
 3    select -3 as sorder, '{"ERROR_JSON": "["Error Message: $ERROR_TEXT"]", "HEADERS": "{"Accept": "*/*", "Content-Type":""}", "FILES": ' as jsonbuffer union all
 4    select -2 as sorder, '"{''import.json'': (''sources.json'', ''' as jsonbuffer union all
 5    select sorder,redsys.base64_encode(text)
 6    from redlin_dataspot.lin_sources  union all
 7    select 99999997 as sorder, ''', ''application/json''),''type'': (None, ''text/plain'') }", ' union all
 8    select 99999998 as sorder, '"EXA-CONNECTION": "REDLIN_DATASPOT_REST_API", "METHOD": "PUT", "TOKENKEY": "dataspot-access-key","URL": "/api/customer/schemes/DB/upload?v=3&dryRun=true&operation=FULL_LOAD&onDelete=INACTIVE", "VERIFY": false' union all
 9    select 99999999 as sorder, '}' as jsonbuffer
10)