# HTTP Client

## Overview

The **HTTP Client Node** allows the user to send *HTTP* requests to a selected *HTTP(S)* server. All configurations are made in the **Node** or in the **Attributes** section. There are several methods that the user can select from to perform different *HTTP* requests. These are: [**GET**](#get), [**POST**](#post), [**PUT**](#put), [**HEAD**](#head), and [**DELETE**](#delete).

[**Scope**](https://github.com/cgi-studio-gmbh/incari-doc/blob/2023.1/toolbox/communication/overview.md#scopes): **Project**, **Scene**.

![HTTP Client Methods.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-2b474ebf1597fdebd3b9cae61756696936163ba6%2Fhttpclientmethod.png?alt=media)

## Common Attributes, Inputs, and Outputs

Depending on the `Method` selected, the **Attributes** and **Inputs** might change. However, there are several common [**Attributes**](#common-attributes), [**Inputs**](#common-inputs), and [**Outputs**](#common-outputs) between the many **HTTP** `Methods`.

### Common Attributes

![HTTP Shared Attributes.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-c69769676c46770ba693643a02356a742705d409%2Fhttpclientattributes.png?alt=media)

| Attribute                 | Type             | Description                                                                                                                                                                                           |
| ------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Remote IP`               | **User Input**   | The *HTTP(S)* endpoint (either a URL or IP address).                                                                                                                                                  |
| `Remote Port`             | **Int**          | The port value. For *HTTP*, the standard is 80 and for *HTTPS*, the standard is 443.                                                                                                                  |
| `Method`                  | **Drop-down**    | Either **GET**, **POST**, **PUT**, **HEAD**, or **DELETE**.                                                                                                                                           |
| `Path`                    | **User Input**   | A specific path from the call being referenced in `Remote IP`. Usually, this is the text after the main root URL but before the `?` character.                                                        |
| `Authentication`          | **Drop-down**    | The user selects `Basic` when a username and password are required to access the information, otherwise `None` is chosen.                                                                             |
| `Default Headers`         | **Add Elements** | *HTTP* headers in the form of key/value pairs.                                                                                                                                                        |
| `Request Query`           | **Add Elements** | Parameters of the call in the form of key/value pairs.                                                                                                                                                |
| `Is Response Body Binary` | **Bool**         | The user chooses true or false depending on whether they wish for the `Response Body` output to remain a **String** or be converted into *binary*. Currently, the **Node** only supports **Strings**. |

### Common Inputs

| Input             | Type           | Description                                                                                                                                    |
| ----------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| *Pulse Input* (►) | **Pulse**      | A standard **Input Pulse**, to trigger the execution of the **Node**.                                                                          |
| `Remote IP`       | **String**     | The *HTTP(S)* endpoint (either a URL or IP address).                                                                                           |
| `Remote Port`     | **Int**        | The port value. For *HTTP*, the standard is 80 and for *HTTPS*, the standard is 443.                                                           |
| `Path`            | **String**     | A specific path from the call being referenced in `Remote IP`. Usually, this is the text after the main root URL but before the `?` character. |
| `Headers`         | **Dictionary** | *HTTP* headers in the form of key/value pairs.                                                                                                 |
| `Query`           | **Dictionary** | Parameters of the call in the form of key/value pairs.                                                                                         |

### Common Outputs

| Output             | Type           | Description                                                                                                                            |
| ------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| *Pulse Output* (►) | **Pulse**      | A standard **Output Pulse**, to move onto the next **Node** along the **Logic Branch**, once this **Node** has finished its execution. |
| `OnResponse` (►)   | **Pulse**      | Flows to additional actions when there is a response.                                                                                  |
| `Status Code`      | **Int**        | A standard status code within the *HTTP* protocol. For example, 404 is when a page is not found.                                       |
| `Headers`          | **Dictionary** | *HTTP* headers in the form of key/value pairs.                                                                                         |
| `Body`             | **String**     | The body of the response, usually including *HTML* text.                                                                               |

## Methods

### GET

![The HTTP Client Node using Method GET.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-ff97c23b7560110cbf79d7f92e3fb753831bb38a%2Fhttpgetupdatedimage.png?alt=media)

**GET** creates a request and returns the response as per the *HTTP* protocol. This is very useful when dealing with web APIs. A more detailed explanation involving web APIs can be found in the **See Also** section. Additional information on the different *HTTP* methods can be found in the **External Links** section.

### POST

![The HTTP Client Node using Method POST.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-83f1bfbb7749e784e2d9b9cde1dbe4ac7f9c65b0%2Fhttppostupdatedimage.png?alt=media)

**POST** sends data, in this case the information from the `Request Body`, to the desired server as per the *HTTP* protocol. More information on the different *HTTP* methods can be found in the **External Links** section. All **Attributes** and **Inputs** are the same as the common **Attributes**, except for the addition of the following:

#### Attributes

![The HTTP Client Node Attributes using Method POST.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-37c68a6770bc3d290442c3fb3be1360e04982452%2Fhttppostattributesreal.png?alt=media)

| Attribute      | Type       | Description                                                                  |
| -------------- | ---------- | ---------------------------------------------------------------------------- |
| `Default Body` | **String** | The body of the *HTTP* request, if none is provided in the **Input Socket**. |

#### Inputs

| Input  | Type       | Description                     |
| ------ | ---------- | ------------------------------- |
| `Body` | **String** | The body of the *HTTP* request. |

### PUT

![The HTTP Client Node using Method PUT.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-a74eec9ae4dd92dcdf293d45953f1ef60a3b245a%2Fhttpputupdatedimage.png?alt=media)

**PUT** updates already existing data on the desired server per the *HTTP* protocol. More information on the different *HTTP* methods can be found in the **External Links** section. All **Attributes** and **Inputs** are the same as the common **Attributes**, except for the addition of the following:

#### Attributes

![The HTTP Client Node Attributes using Method PUT.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-37c68a6770bc3d290442c3fb3be1360e04982452%2Fhttppostattributesreal.png?alt=media)

| Attribute      | Type       | Description                                                                  |
| -------------- | ---------- | ---------------------------------------------------------------------------- |
| `Default Body` | **String** | The body of the *HTTP* request, if none is provided in the **Input Socket**. |

#### Inputs

| Input  | Type       | Description                     |
| ------ | ---------- | ------------------------------- |
| `Body` | **String** | The body of the *HTTP* request. |

### HEAD

![The HTTP Client Node using Method HEAD.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-b3a7c1be6646c063fb35a35a1ec7094a011623fd%2Fhttpheadupdatedimage.png?alt=media)

**HEAD** requests the headers on the desired server in order to gather information about the data, but not the content of the data itself. More information on the different *HTTP* methods can be found in the **External Links** section. All **Attributes** and **Inputs** are the same as the common **Attributes**.

### DELETE

![The HTTP Client Node using Method DELETE.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-deb6dc24a80bc9cb0fc4dcf57a158425b1f45e59%2Fhttpdeleteupdatedimage.png?alt=media)

**DELETE** deletes data on the desired server per the *HTTP* protocol. More information on the different *HTTP* methods can be found in the **External Links** section. All **Attributes** and **Inputs** are the same as the common **Attributes**, except for the addition of the following:

#### Attributes

![The HTTP Client Node Attributes using Method DELETE.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-37c68a6770bc3d290442c3fb3be1360e04982452%2Fhttppostattributesreal.png?alt=media)

| Attribute      | Type       | Description                                                                  |
| -------------- | ---------- | ---------------------------------------------------------------------------- |
| `Default Body` | **String** | The body of the *HTTP* request, if none is provided in the **Input Socket**. |

#### Inputs

| Input  | Type       | Description                     |
| ------ | ---------- | ------------------------------- |
| `Body` | **String** | The body of the *HTTP* request. |

## See Also

* [**Using APIs to Pull Dynamic Data**](https://docs.incari.com/incari-studio/2023.1/demo-projects/using-apis-to-pull-dynamic-data)

## External Links

* [Different *HTTP* Methods](https://www.w3schools.com/tags/ref_httpmethods.asp) on W3Schools.
