Send web request to [value] and store answer in [variable]

Last modified by admin on 2023/10/05 08:53

Sends a web request to a specified address (URL). Stores the answer in a specified variable.

A web request is a way to communicate with a server on the internet. This feature is used to fetch data from websites or web services, such as fetching weather information or retrieving data from a database.

ATTENTION: Web requests are very powerful, but also very dangerous.
Learn more >>

send-web-request-brick.png

Example

Sends a web request to retrieve a random joke. The answer is extracted with the help of regular expressions.

store-column-example.png

The free joke api returns data in the following json format:

{"id":10,"type":"general","setup":"What kind of shoes does a thief
wear?","punchline":"Sneakers"}

To extract the setup phrase in case you stored the result in variable "joke", use the following regular expression:
regular expression( '"setup":"(.*?)"' , "joke" )

The result will be: What kind of shoes does a thief wear?

To extract the setup phrase, use the following regular expression:
regular expression( '"punchline":"(.*?)"' , "joke" )

The result will be: Sneakers

Result

Download

store-column-example.gif