Skip to content

Web

Non-Visible component
Category Requires Version
Connectivity API 21, Android 5.0 Lollipop 6

Overview

A non-visible component that provides functions for HTTP GET, POST, PUT, and DELETE requests.

Permissions

Events

Got File

Event indicating that a request has finished.

Params
url Text
response Code Number
response Type Text
file Name Text

Got Text

Event indicating that a request has finished.

Params
url Text
response Code Number
response Type Text
response Content Text

Timed Out

Event indicating that a request has timed out.

Params
url Text

Methods

Build Request Data

Returns: Text

Converts a list of two-element sublists, representing name and value pairs, to astring formatted as application/x-www-form-urlencoded media type, suitable to pass toPostText.

Params
list List

Clear Cookies

Clears all cookies for this Web component.

Delete

Performs an HTTP DELETE request using the Url property and retrieves theresponse.
If the SaveResponse property is true, the response will be saved in a fileand the GotFile event will be triggered. The ResponseFileName propertycan be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will betriggered.

Get

Performs an HTTP GET request using the Url property and retrieves theresponse.
If the SaveResponse property is true, the response will be saved in a fileand the GotFile event will be triggered. The ResponseFileName propertycan be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will betriggered.

HTML Text Decode

Returns: Text

Decodes the given HTML text value. HTML character entities such as &amp;, &lt;, &gt;, &apos;, and &quot; are changed to &, <, >, ', and ". Entities such as &#xhhhh, and &#nnnn are changed to the appropriate characters.

Params
html Text Text

JSON Text Decode

Returns: Any

Decodes the given JSON encoded value to produce a corresponding AppInventor value A JSON list [x, y, z] decodes to a list (x y z), A JSON object with name A and value B,(denoted as A:B enclosed in curly braces) decodes to a list((A B)), that is, a list containing the two-element list (A B).

Params
json Text Text

Post File

Performs an HTTP POST request using the Url property and data from the specified file.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The ResponseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.

Params
path Text

Post Text

Performs an HTTP POST request using the Url property and the specified text.
The characters of the text are encoded using UTF-8 encoding.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The responseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.

Params
text Text

Post Text With Encoding

Performs an HTTP POST request using the Url property and the specified text.
The characters of the text are encoded using the given encoding.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The ResponseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.

Params
text Text
encoding Text

Put File

Performs an HTTP PUT request using the Url property and data from the specified file.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The ResponseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.

Params
path Text

Put Text

Performs an HTTP PUT request using the Url property and the specified text.
The characters of the text are encoded using UTF-8 encoding.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The responseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.

Params
text Text

Put Text With Encoding

Performs an HTTP PUT request using the Url property and the specified text.
The characters of the text are encoded using the given encoding.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The ResponseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.

Params
text Text
encoding Text

URI Decode

Returns: Text

Decodes the encoded text value.

Params
text Text

URI Encode

Returns: Text

Encodes the given text value so that it can be used in a URL.

Params
text Text

XML Text Decode

Returns: Any

Decodes the given XML string to produce a list structure. See the App Inventor documentation on "Other topics, notes, and details" for information.

Params
XmlText Text

Properties

Allow Cookies

Boolean Default: false ➖ Read Write - Designer Blocks

Whether the cookies from a response should be saved and used in subsequent requests. Cookies are only supported on Android version 2.3 or greater.

Request Headers

List ➖ Read Write - Blocks

The request headers, as a list of two-element sublists. The first element of each sublist represents the request header field name. The second element of each sublist represents the request header field values, either a single value or a list containing multiple values.

Response File Name

Text ➖ Read Write - Designer Blocks

The name of the file where the response should be saved. If SaveResponse is true and ResponseFileName is empty, then a new file name will be generated.

Save Response

Boolean Default: false ➖ Read Write - Designer Blocks

Whether the response should be saved in a file.

Timeout

Number Default: 0 ➖ Read Write - Designer Blocks

The number of milliseconds that a web request will wait for a response before giving up. If set to 0, then there is no time limit on how long the request will wait.

URL

Text ➖ Read Write - Designer Blocks

The URL for the web request.


Last update: November 9, 2022