1. Configuration
  2. Example

URL Fetch extension

WEBCALL allow to send asynchronously a request to a distance webservice, but it ignores the answer. URLFETCH is designed to send request synchronously. It blocks until you get an answer from the server.

You need to be authenticated with a valid token with the function AUTHENTICATE before using URLFETCH.

URLFETCH do GET request on the URL input.

This extension add the following functions to WarpScript:

URLFETCH always add the following headers:

User-Agent: Java/1.8.0_171
Host: localhost:9001
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive


Your custom configurations can be stored in a new etc/conf.d/99-myWarp10.conf file. Your custom configurations will override all the predefined Warp 10 configuration.

warpscript.extension.urlfetch = io.warp10.script.ext.urlfetch.UrlFetchWarpScriptExtension
// Maximum number of URLFETCH calls, 64 by default for soft and hard
warpscript.urlfetch.limit = 10
warpscript.urlfetch.limit.hard = 1000
// Maximum downloaded bytes by URLFETCH, 1000000 by default for soft and hard
warpscript.urlfetch.maxsize = 1000000
warpscript.urlfetch.maxsize.hard = 1000000000
// List of patterns to include/exclude for hosts, works the same way as webcall.host.patterns. 
// Defaults to the value of webcall.host.patterns.
warpscript.urlfetch.host.patterns = .*


This WarpScript will try to fetch your public IP on different services.

// @endpoint http://yourinstance/api/v0/exec 'yourReadToken' AUTHENTICATE // this services will return your public IP on internet. [ 'http://ifconfig.me' 'http://icanhazip.com' 'http://ifconfig.co' // on this one, cloudflare will refuse java agent. ] URLFETCH // STOP //uncomment to see the raw answer <% //decode the payload of each answer DROP 3 GET B64-> 'ascii' BYTES-> %> LMAP