Get URL
The get URL Deluge task corresponds to a HTTP GET
request. It is normally supported by services to perform read-only operations
like fetching data from external websites.
Syntax
a. To get a simple response with only the response content as
String:
<string-variable> = getUrl("<url string>")
|
where,
<string-variable> - the name of the string variable to hold
the response content in string format.
<url string> - the URL to be accessed, for example, "http://www.zoho.com"
b. To get a detailed response that returns the response code (http
status code) and response content as a key-value pair.
<map-variable> = getUrl("<url string>",false)
|
where,
<map-variable> - the name of the map variable to hold the
response code and response content.
<URL String> - the URL to be accessed, for example, "http://www.zoho.com"
|
Note: You can use the encodeURL() function to encode the url string.
|
Syntax to get response code and response text
map.get("responseCode"); map.get("responseText");
|
If the reponse text is of type XML, the executeXPath
statement can be used to select nodes from the document. If the response
text is of type JSON, it can be converted to XML.
Using Script Builder
To add the Get URL task in Script Builder,
- Drag-n-drop the Web Data - get URL from the left-side task tree.
- Click on Edit to display the Edit dialog.
- Specify the URL string of the external website
- Select "Simple Response" to get only the response
content as a string or the "Detailed Response" to get
the response code and response content as a key-value pair.
- Specify the response variable name.
- Click Done to add the value to the script editor, as shown
in the screen-shot given below:

Example