Loading

URLFETCH

Extension: io.warp10.script.ext.urlfetch.UrlFetchWarpScriptExtension

extensions web
Configuration parameters

The URLFETCH function sends HTTP(S) GET requests, waits for the responses and puts them on the stack.

For security reasons, the stack must be authenticated for this function to work, see AUTHENTICATE.

Since 2.7.0, this function also accepts a MAP of headers.

URLFETCH is available since version 1.0.2.

See also

Signatures

Examples

'READ_TOKEN' AUTHENTICATE // You need a valid token 'https://warp10.io' URLFETCH 0 GET // Only one URL, get the first and only result 3 GET // Get the payload B64-> 'utf8' BYTES-> // Convert it to a string
'READ_TOKEN' AUTHENTICATE // You need a valid token [ 'https://httpstat.us/200' 'https://httpstat.us/404' 'https://httpstat.us/418' ] URLFETCH <% DROP 1 GET // Get only the status message %> LMAP // For each returned result

Examples

AUTHENTICATE('READ_TOKEN') // You need a valid token response = URLFETCH('https://warp10.io') result = response[0] // Only one URL, get the first and only result payload = result[3] // Get the payload return BYTES->(B64->(payload, 'utf8')) // Convert it to a string