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

# HTTP

The Http package contains various functions and events for performing and responding to HTTP requests.

## HTTP

### Endpoint

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FoV7GQAhwdanilhNfear7%2Fimage.png?alt=media&amp;token=3b21cb7a-b17f-4be8-9327-c98064c9b69c" alt=""><figcaption></figcaption></figure></div>

Listens for http requests on the provided `path` and `method`. `path` is an url of the form some/path/, which can be parameterized by :name for path items, and ?query\_name\&another\_query\_name for query values. Example: 'user/:name?email\&joined\_date' This creates `name`, `email` and `joined_date` output properties that one can use to get these values from the request. NOTE: All endpoints currently shares a single http server.

### Response

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2Fwfc8fhMw4an0Q0gzSJ2y%2Fimage.png?alt=media&amp;token=8590dd7f-4e40-418b-b2b4-9cf2a4a87a74" alt="" width="264"><figcaption></figcaption></figure></div>

Responds to an HTTP request provided by an `Http.Endpoint` event. This function must be called downstream from an `Http.Endpoint` in order to have anything to respond to.

### Fetch

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2F39QCGdK26zotEBvWKb4z%2Fimage.png?alt=media&amp;token=de31709c-57ae-463b-8df2-dacbcb348522" alt="" width="563"><figcaption></figcaption></figure></div>

Performs a simple http/https request to the provided `url` and returns the `response` as a string, buffer or object depending on the value of `response type`, which can be 'text', 'buffer' or 'json'. The body input will be converted to json if it is anything other than a String or Null.

### FetchStreamed

<figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FvaobsIiUniNxgARTCBVh%2Fimage.png?alt=media&amp;token=6d29a2b4-a728-47d3-b6dd-9bc731a6bf4b" alt=""><figcaption></figcaption></figure>

Performs an http request to the given `url`, expecting it to respond with a SSE-stream, messages from which can be read using `Http.NextMessage`.

### NextMessage

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FiG6IqNscI3OjTnyKlzZV%2Fimage.png?alt=media&amp;token=7e9d50aa-ed13-4ca8-b561-75368524217a" alt="" width="341"><figcaption></figcaption></figure></div>

Reads the next message from the SSE stream. This function must be called downstream from a call to \`Http.FetchUrlStreamed\`.

## Url

### UrlEncodeFormData

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FtGPtbTVBPLIrYfyxdiWH%2Fimage.png?alt=media&amp;token=ff9ec733-4bff-4d82-9e8b-ad2018e9bbd6" alt="" width="345"><figcaption></figcaption></figure></div>

### UrlEncodeString

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FsN7AwSYXGpSbXxKEcvbN%2Fimage.png?alt=media&amp;token=930d61a8-3ed9-4ca9-a320-60e7e6c04f3d" alt="" width="322"><figcaption></figcaption></figure></div>

### UrlDecodeString

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FF7n3miKKMOkkcY1B3QxB%2Fimage.png?alt=media&amp;token=bbaefaf2-aa75-4e68-a8a6-03c5ea70e58d" alt="" width="352"><figcaption></figcaption></figure></div>

### UrlDecodeComponent

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FQ8tuhxLAOYQfE7mDRfVL%2Fimage.png?alt=media&amp;token=979326e8-d6a1-4493-b4c9-e624deff6804" alt="" width="355"><figcaption></figcaption></figure></div>

## <mark style="color:orange;">Advanced</mark>

### Client

The `Http Client`module contains a lower level API for performing Http requests. Http FetchUrl `and Http FetchStreamed`  should cover most use-cases.

<figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FsttmEOHvjCeFgCxrGSfs%2Fimage.png?alt=media&amp;token=d1c40858-bc46-44ac-b24c-e0468220fd21" alt=""><figcaption></figcaption></figure>

OpenNetworkStream

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FZifCxqbB1xZ0JhFSDdL9%2Fimage.png?alt=media&amp;token=83300ae5-4224-4fa0-89b7-9c52d394ef19" alt="" width="375"><figcaption></figcaption></figure></div>

Opens a new network stream.

CreateRequest

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FLIwJVZIWuNlkuSUNF8UV%2Fimage.png?alt=media&amp;token=8b145775-8239-4801-acbe-31a97ee8a212" alt="" width="563"><figcaption></figcaption></figure></div>

#### SendRequest

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2F4VhsKv36zhUxCcF39OOO%2Fimage.png?alt=media&amp;token=74f6cf10-feff-4610-b06d-6465082b4290" alt="" width="330"><figcaption></figcaption></figure></div>

#### ResponseBodyStream

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FglMIcBl688R2wKHGQHqN%2Fimage.png?alt=media&amp;token=0bc68c7e-18c2-4590-91fa-ce58076c206f" alt="" width="563"><figcaption></figcaption></figure></div>

Streams content from a response body as descrete events.

ResponseStatus

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FEQTxVcqTyguLPZ8Z5ZpM%2Fimage.png?alt=media&amp;token=66a28c97-ae79-43d8-aff3-27a1c44cadb5" alt="" width="563"><figcaption></figcaption></figure></div>

ResponseHeaders

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FhN6MWIGyUvu6i0kw7tNF%2Fimage.png?alt=media&amp;token=14e5c4a3-f139-44e9-9a94-96b1e02b8927" alt="" width="563"><figcaption></figcaption></figure></div>

ResponseBody

<div align="left"><figure><img src="https://1896308808-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRdFpuRAnTVYgmlCXLLou%2Fuploads%2FGXqPwozup378zuCWNljA%2Fimage.png?alt=media&amp;token=ecaa8b68-c154-48ab-8703-6d1c383c9a02" alt="" width="563"><figcaption></figcaption></figure></div>
