HTTP request

Description

Sends an HTTP request with the specified parameters. The 'Save value to variable' block appears automatically when choosing the 'HTTP request' function. It automatically saves the value to a variable. However, the block is not mandatory to use and can be removed from the workflow.

Parameters

URL

Path to the web resource to which a request will be sent, for example, http://en.wikipedia.org/w/api.php.

Method

Enables you to choose a request method: "GET", "POST", "PUT", "DELETE" .

Authorization header

Enables you to add authorization data when needed.

Additional headers

Enables you to set custom http-request headers.

Query parameters

Enables you to set query parameters as an object.

  1. Save the previous step result: chooses the previous function result as an object with parameters.

  2. Calculate a value: enables you to use available properties and methods to form an object, for example,{action: "opensearch", search: "JavaScript", format: "xml"}.

Body parameters

Available only if either "POST", "PUT" or "DELETE" method is selected. Contains body parameters as an object.

  1. Save the previous step result: chooses the previous function result as an object with parameters.

  2. Calculate a value: enables you to use available properties and methods to form an object.

Send file

Available only when the "POST" method is selected. This parameter allows you to send a file in the request.

  1. Set a value: enables you to directly write a path to the file that is to be sent. Clicking the 'Pick' button allows you to manually choose the path.

  2. Save the previous step result: chooses the previous function result as a path.

  3. Calculate a value: enables you to use available properties and methods to form a path.

Form field file

This parameter contains the key field name in the request body which contains the file path that is to be sent.

  1. Set a value: enables you to directly write the field name, for example, file.

  2. Save the previous step result: chooses the previous function result as a name.

  3. Calculate a value: enables you to use available properties and methods to form a name.

Comment

Contains an annotation to the block. The input text will be displayed inside the block above the function name.

Result

The response result is stored in the http_response variable by default. The variable format depends on the address used in the request. For example, if using the Wikipedia API and sending a request with the 'GET' method and {action: "opensearch", search: "JavaScript"} parameters, the following result is returned:

The response from the Wikipedia API
[
"JavaScript",
[
"JavaScript",
"JavaScript syntax",
"JavaScript engine",
"JavaScript library",
"JavaScript InfoVis Toolkit",
"JavaScript Style Sheets",
"JavaScript templating",
"JavaScriptMVC",
"JavaScript framework",
"JavaScript OSA"
],
[
"JavaScript (), often abbreviated as JS, is a high-level, interpreted scripting language that conforms to the ECMAScript specification.",
"The syntax of JavaScript is the set of rules that define a correctly structured JavaScript program.",
"A JavaScript engine is a computer program that executes JavaScript (JS) code. The first JavaScript engines were mere interpreters, but all relevant modern engines utilize just-in-time compilation for improved performance.JavaScript engines are typically developed by web browser vendors, and every major browser has one.",
"A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies.",
"The JavaScript InfoVis Toolkit provides tools for creating Interactive Data Visualizations for the Web.",
"JavaScript Style Sheets (JSSS) was a stylesheet language technology proposed by Netscape Communications Corporation in 1996 to provide facilities for defining the presentation of webpages.",
"JavaScript templating refers to the client side data binding method implemented with the JavaScript language.",
"JavaScriptMVC is an open-source rich Internet application framework based on jQuery and OpenAjax. It extends those libraries with a model–view–controller architecture and tools for testing and deployment.",
"A JavaScript framework is an application framework written in JavaScript. It differs from a JavaScript library in its control flow: A library offers functions to be called by its parent code, whereas a framework defines the entire application design.",
"JavaScript OSA, (originally JavaScript for OSA, abbreviated as JSOSA), is a freeware inter-process communication scripting language for the Macintosh computer."
],
[
"https://en.wikipedia.org/wiki/JavaScript",
"https://en.wikipedia.org/wiki/JavaScript_syntax",
"https://en.wikipedia.org/wiki/JavaScript_engine",
"https://en.wikipedia.org/wiki/JavaScript_library",
"https://en.wikipedia.org/wiki/JavaScript_InfoVis_Toolkit",
"https://en.wikipedia.org/wiki/JavaScript_Style_Sheets",
"https://en.wikipedia.org/wiki/JavaScript_templating",
"https://en.wikipedia.org/wiki/JavaScriptMVC",
"https://en.wikipedia.org/wiki/JavaScript_framework",
"https://en.wikipedia.org/wiki/JavaScript_OSA"
]
]

Usage Examples

This function allows you to interact with different web-resources so its use range is pretty wide. An example of applying this feature to a robotic process may be a case where you need to connect to a Web-API to get or upload some data.