# Web

## AsDocumentHttpResult

Binary content to consume.

#### Syntax

```
AsDocumentHttpResult ( Response , FileName [, MimeType] )
```

**Parameters**

* **Response**\
  The response object returned from the ExecuteHttpRequest.\
  Type: HttpResponse
* **FileName**\
  The file name of the document.\
  Type: String
* ***MimeType*** (optional)\
  The MIME type of the document. Analyses the header 'Content-Type' if left empty or the FileName extension if the header is missing as well.\
  Type: String

**Return Type**

Document

## AsFormUrlEncodedHttpResult

Returns the received form URL-encoded content as a List\<Entry\<String,String>>.

#### Syntax

```
AsFormUrlEncodedHttpResult ( Response )
```

**Parameters**

* **Response**\
  The response object returned from the ExecuteHttpRequest.\
  Type: HttpResponse

**Return Type**

List\<Entry\<String,String>>

## AsJsonHttpResult

Deserializes the recieved JSON content.

#### Syntax

```typescript
Any AsJsonHttpResult(
    HttpResponse Response
)
```

**Parameters**

* **Response**\
  The response object returned from the ExecuteHttpRequest\
  Type: HttpResponse

**Return Type**

Any

## AsMultipartFormDataHttpResult

Returns the received Multi-part form-data content. Each part can have a Name (String) and a FileName (String) and will have a Response (HttpResponse).

{% hint style="warning" %}
Warning: The return value is not serializable which will cause input request errors!
{% endhint %}

#### Syntax

```
AsMultipartFormDataHttpResult ( Response )
```

**Parameters**

* **Response**\
  The response object returned from the ExecuteHttpRequest.\
  Type: HttpResponse

**Return Type**

List\<Dictionary\<String,Any>>

## AsStringHttpResult

Returns the received content as a String.

#### Syntax

```
AsStringHttpResult ( Response )
```

**Parameters**

* **Response**\
  The response object returned from the ExecuteHttpRequest.\
  Type: HttpResponse

**Return Type**

String

## DeserializeFromJson

Deserializes lists or objects from JSON. Scalar values (Any) and values of type List and Dictionary are supported and can be returned.

#### Syntax

```typescript
Any DeserializeFromJson(
    String Json
)
```

**Parameters**

* **Json**\
  The JSON to deserialize to a value.\
  Type: Any

**Return Type**\
Any

## DocumentHttpContent

Binary content to send (use with HttpRequest). Sets the header 'Content-Type' to the MIME type of the document (defaults to "application/octet-stream").

{% hint style="warning" %}
The return value is not serializable which will cause input request errors!
{% endhint %}

#### Syntax

```
DocumentHttpContent ( Value )
```

**Parameters**

* **Value**\
  The binary content to send.\
  Type: Document

**Return Type**

HttpContent

## ExecuteHttpRequest

Executes an HTTP request and returns the response. The response has a StatusCode (Integer), IsSucessStatusCode (Boolean) and Headers (Dictionary\<String,String>) accessable through GetValue. Warning: The return value is not serializable which will cause input request errors!

#### Syntax

```
HttpResponse ExecuteHttpRequest(
    Any Request
)
```

**Parameters**

* **Request**\
  The object to send serialized as JSON (e.g. Dictionary\<String,Any> or List\<Dictionary\<String,Any>>)\
  Type Any

**Return Type**

HttpResponse

## FormUrlEncodedHttpContent

Form URL-encoded content to send (use with HttpRequest). Sets the header 'Content-Type' to "application/x-www-form-urlencoded".

{% hint style="warning" %}
Warning: The return value is not serializable.
{% endhint %}

#### Syntax

```
FormUrlEncodedHttpContent ( Value )
```

**Parameters**

* **Value**\
  The form values to send.\
  Type: List\<Entry\<String,String>>

**Return Type**

HttpContent

## HttpRequest

Represents an HTTP request (use with ExecuteHttpRequest). Warning: The return value is not serializable which will cause input request errors!

#### Syntax

```
HttpRequest HttpRequest(
    String Method,
    String Uri,
    Dictionary<String,String> [Headers],
    HttpContent [Content]
)
```

**Parameters**

* **Method**\
  The HTTP method to be performaned ('DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE')\
  Type String
* **Uri**\
  The URI to request to\
  Type String
* **Headers** (optional)\
  The HTTP headers associated with the request\
  Type Dictionary\<String,String>
* **Content** (optional)\
  The content to send with the request\
  Type HttpContent

**Return Type**

HttpRequest

## JsonHttpContent

Content serialized as JSON to send (use with HttpRequest). Warning: The return value is not serializable which will cause input request errors!

#### Syntax

```
HttpContent JsonHttpContent(
    Any Value
)
```

**Parameters**

* **Value**\
  The object to send serialized as JSON (e.g. Dictionary\<String,Any> or List\<Dictionary\<String,Any>>)\
  Type Any

**Return Type**

HttpContent

## MultipartFormDataHttpContent

Multi-part form-data content to send (use with HttpRequest). Sets the header 'Content-Type' to "multipart/form-data".

{% hint style="warning" %}
Warning: The return value is not serializable which will cause input request errors!
{% endhint %}

#### Syntax

```
MultipartFormDataHttpContent ( Value )
```

**Parameters**

* **Value**\
  The Multi-part form-data to send. Each Value part can have a Name (String) and a FileName (String) and must have Content (HttpContent).\
  Type: List\<Dictionary\<String,Any>>

**Return Type**\
HttpContent

## SerializeToJson

Serializes lists or objects to JSON. Scalar values (Any) and values of type List, Object and Dictionary are supported.

#### Syntax

```typescript
Any SerializeToJson(
    String Json
)
```

**Parameters**

* **Value**\
  The value to serialize to JSON.\
  Type: Any

**Return Type**\
String

## StringHttpContent

Content to send (use with HttpRequest). Sets the header 'Content-Type' to "text/plain". The content is encoded as UTF-8.&#x20;

{% hint style="warning" %}
Warning: The return value is not serializable.
{% endhint %}

#### Syntax

```
StringHttpContent ( Value )
```

**Parameters**

* **Value**\
  The string value to send.\
  Type: String

**Return Type**\
HttpContent

## UrlDecode

Decodes invalid URL characters encoded into character-entity equivalents back (e.g. %3c to < or %3e to >).

#### Syntax

```
UrlDecode ( Value )
```

**Parameters**

* **Value**\
  The value to decode.\
  Type: String

**Return Type**\
String

## UrlEncode

Encodes invalid URL characters into character-entity equivalents (e.g. < to %3c or > to %3e).

#### Syntax

```
UrlEncode( Value )
```

**Parameters**

* **Value**\
  The value to encode.\
  Type: String

**Return Type**\
String


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tivity.one/building-an-application/execution/scripting/functions/web.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
