# HTTP

Returns a fluent HTTP client for making HTTP requests.

This BIF creates a new or retrieves an existing BoxHttpClient instance based on the provided connection parameters. The client can be used to fluently build and execute HTTP requests with support for various HTTP versions, redirects, timeouts, proxy configuration, and client certificates.

Example usage:

```
 // Simple GET request
 http( "https://api.example.com/data" )
     .invoke()
     .ifSuccess( result -> {
 		// Handle successful response
 	} )
     .ifError( error -> {
 		// Handle error response
 	} )

 // Invoke and get the result immediately, throwing an exception on error
 result = http( "https://api.example.com/data" )
 	.invokeAndGet().
 
```

## Method Signature

```
HTTP(URL=[string], connectionTimeout=[numeric], redirect=[boolean], httpVersion=[string], proxyServer=[string], proxyPort=[integer], proxyUser=[string], proxyPassword=[string], clientCert=[string], clientCertPassword=[string])
```

### Arguments

| Argument             | Type      | Required | Description                                                                                  | Default  |
| -------------------- | --------- | -------- | -------------------------------------------------------------------------------------------- | -------- |
| `URL`                | `string`  | `true`   |                                                                                              |          |
| `connectionTimeout`  | `numeric` | `false`  | The connection timeout in milliseconds (default: BoxHttpClient.DEFAULT\_CONNECTION\_TIMEOUT) | `15`     |
| `redirect`           | `boolean` | `false`  | Whether to automatically follow HTTP redirects (default: true)                               | `true`   |
| `httpVersion`        | `string`  | `false`  | The HTTP version to use (default: HTTP/2)                                                    | `HTTP/2` |
| `proxyServer`        | `string`  | `false`  | The proxy server address (requires proxyPort)                                                |          |
| `proxyPort`          | `integer` | `false`  | The proxy server port (requires proxyServer)                                                 |          |
| `proxyUser`          | `string`  | `false`  | The proxy authentication username (requires proxyPassword)                                   |          |
| `proxyPassword`      | `string`  | `false`  | The proxy authentication password (requires proxyUser)                                       |          |
| `clientCert`         | `string`  | `false`  | The path to the client certificate file                                                      |          |
| `clientCertPassword` | `string`  | `false`  | The password for the client certificate                                                      |          |

## Examples

## Related

* [SOAP](/boxlang-language/reference/built-in-functions/net/soap.md)


---

# 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://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/net/http.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.
