> For the complete documentation index, see [llms.txt](https://docs.rulecube.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rulecube.com/v2.5/language-reference/http.md).

# Http

Collection of HTTP functions.

### Methods

#### request

```javascript
request(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP Request. Can be used to post or get data to and from a URL.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.request('http://www.example.com/data.json')        // GET data from a URL
Http.request('http://www.example.com/api/person', {     // POST data to a URL
  method: 'post',
  headers: {
    'X-Auth-Token': 'secret_token'
  },
  data: {
    firstName: 'John',
    age: 30
  }
})

// Example of getting binary data (as base64):
//  When fetching binary data, the "responseType" must be set to "base64". 
//  The response data will be a base64 encoded string.
Http.request('http://www.example.com/logo.png', { responseType: 'base64' })

// Example of a POST request where we do not wait for the response (fire-and-forget):
Http.request('http://www.example.com/api/big-data', {
  wait: false,
  method: 'post',
  data: {}
})
```

#### all

```javascript
all(requests: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
}[])
```

Create multiple parallel HTTP requests and returns when all responses have been received. Responses are returned in an array in the same order as the requests.

**Parameters**

&#x20;   **requests&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}\[]***

&#x20;       Array of requests. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }\[]

**Examples**

```javascript
Http.all([
  { url: 'http://www.example.com/data.json' }
  { url: 'http://www.example.com/api/add', method: 'post', data: { a: 1, b: 2 } }
])
```

#### get

```javascript
get(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP GET Request.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.get('http://www.example.com/data.json')
```

#### post

```javascript
post(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP POST Request.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.post('http://www.example.com/data.json')
Http.post('http://www.example.com/api/person', {
  data: {
    firstName: 'John',
    age: 30
  }
})
```

#### put

```javascript
put(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP PUT Request.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.put('http://www.example.com/data.json')
Http.put('http://www.example.com/api/person', {
  data: {
    firstName: 'John',
    age: 31
  }
})
```

#### delete

```javascript
delete(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP DELETE Request.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.delete('http://www.example.com/data.json')
```

#### head

```javascript
head(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP HEAD Request.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.head('http://www.example.com/data.json')
```

#### patch

```javascript
patch(url: string, options?: {
    method?: any,
    headers?: Record<string, string>,
    data?: any,
    wait?: boolean,
    url?: string,
    baseURL?: string,
    params?: any,
    timeout?: number,
    withCredentials?: boolean,
    auth?: any,
    responseType?: string,
    responseEncoding?: string,
    xsrfCookieName?: string,
    xsrfHeaderName?: string,
    maxContentLength?: number,
    maxBodyLength?: number,
    maxRedirects?: number,
    proxy?: any,
    decompress?: boolean, 
    httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }
})
```

Create a HTTP PATCH Request.

**Parameters**

&#x20;   **url&#x20;*****string***

&#x20;       The URL.

&#x20;   **options&#x20;*****{ method?: any, headers?: Record\<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }}***

&#x20;       (optional) Options object - set headers, method and other properties. [More information](https://axios-http.com/docs/req_config)

**Return type**

&#x20;   { data: any, status: number, statusText: string, headers: Record\<string, string>, error?: string }

**Examples**

```javascript
Http.patch('http://www.example.com/data.json')
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.rulecube.com/v2.5/language-reference/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.
