# 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.](/files/fvA9du3GyUVGW51sdPgA)

## 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.](/files/SQuPEjERiS6bl1B2DQSI)

| 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.](/files/LHW6jZAMWv1GuIuWI3RV)

**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.](/files/OeBt2UQFRQPHSP49nFK1)

**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.](/files/tTiilsNxQj4e6y7Hbl47)

| 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.](/files/XtoPYSPaSgSfkeL376wN)

**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.](/files/tTiilsNxQj4e6y7Hbl47)

| 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.](/files/UeFUqIchP8Dhg9zp7Ewe)

**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.](/files/sqvmYvj4qaXgFP7OWEDG)

**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.](/files/tTiilsNxQj4e6y7Hbl47)

| 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**](/incari-studio/2023.1/demo-projects/using-apis-to-pull-dynamic-data.md)

## External Links

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


---

# 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.incari.com/incari-studio/2023.1/toolbox/communication/http/httpclient.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.
