> For the complete documentation index, see [llms.txt](https://docs.heisenware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.heisenware.com/~/changes/Q625pQNc0nXqVGPtyjAY/building-apps/integration/protocol-connectors/http-rest.md).

# HTTP/REST

To integrate data from HTTP/REST servers exposed to the internet, you can establish a connection with a REST API. To start, navigate to  `Protocol Connectors` in the functions panel and unfold `HTTP/REST`.

{% hint style="info" %}
To integrate a  server from a local network, you need to deploy an HTTP/REST [edge connector](/~/changes/Q625pQNc0nXqVGPtyjAY/building-apps/integration/edge-connector.md) first. Afterward, you can use the same functions described in this article.
{% endhint %}

## REST API instance

If a REST API is to be integrated and your app needs to repeatedly access this API using different types of requests or resources, it is recommended to create an instance for this connection to avoid re-entering the URL every time.

### Create a REST API connection

With the `create` function, you can add a fixed REST API connection instance and use all the [RESTful server request functions](#restful-server-requests) below. Do so by using and configuring the create function. Remember to name your instance in the yellow naming box.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2F2PZ2NbFNTLjyyecfGR7B%2Fimage.png?alt=media&amp;token=21c1672e-ecf4-4d18-819b-75365c6ccd4d" alt=""><figcaption><p>Add a REST API to the functions panel</p></figcaption></figure>

The connection instance will appear in the functions panel. After that, you can use the functions from inside the instance from under `Protocol Connectors -> HTTP/REST -> {instance name}` by dragging them onto the board.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FLtwnoCGf6MXw62XHub76%2Fimage.png?alt=media&amp;token=9f3bcb59-5f58-44b9-a347-a96c2976f821" alt="" width="563"><figcaption><p>Example of <a href="#do-a-get-request"><code>GET</code></a> usage with pre-existing REST instance</p></figcaption></figure>

### Delete a REST API connection

To remove a REST API connection, use the `delete` function by inserting the name of the instance into the yellow box and triggering the function.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FG9viKRVZQP0fUz4Rn3R6%2Fimage.png?alt=media&amp;token=31cb8d7a-5360-4e72-876a-cf48b917acc1" alt="" width="375"><figcaption><p>Removing a REST API instance</p></figcaption></figure>

## RESTful server requests

The [HTTP/REST protocol](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) functions are used to connect to an existing HTTP server with RESTful requests. All these functions are also available within a connection instance, specifically created for a connected REST API.

### Do a GET request

With the `get` function, you can do a simple HTTP `GET` request to a server. Parameters can either be added at the end of the URL in the first input box or as an object in the second input box. The output is a JSON object with the HTTP header information removed.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FZPuHuGegfGTeOPQpLKPu%2Fimage.png?alt=media&amp;token=070310f3-661d-4682-ba4b-61ebdc6d89c3" alt=""><figcaption><p>Example GET request</p></figcaption></figure>

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FAk0ETVTuFR2SNKpnjCfC%2Fimage.png?alt=media&amp;token=85f33d6e-9708-43b5-a6fc-2915f2518c1f" alt=""><figcaption><p>The same GET request, but using the parameter input box</p></figcaption></figure>

### Do a DELETE request

Using the `delete` function, you can remove a resource from a server. Enter the URL of the resource you wish to delete in the input box and execute the function. `DELETE` requests typically don't include parameters. The output is the HTTP response in full, including header information.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FYSSK5r31X79fL18GjDVm%2Fimage.png?alt=media&amp;token=ec477f3e-8749-48e8-9ba9-abf5d1e57565" alt=""><figcaption><p>Removing a resource with a DELETE request</p></figcaption></figure>

### Do a HEAD request

With the `head` function, you can do a [`HEAD`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) request to a server, e.g. to get the content length of a GET request, without actually getting the content. Follow the same syntax as in the [`GET`](#do-a-get-request) example.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FJ6i8NtvZFbkayepjcS5r%2Fimage.png?alt=media&amp;token=787c2e51-f2fc-4ffb-ac97-dc5a5ce44fce" alt=""><figcaption><p>HEAD request with same URL as in the GET example</p></figcaption></figure>

### Do an OPTIONS request

With the `options` function, you can request which HTTP requests you are allowed to do on a specific resource. The allowed requests are listed under `headers -> allow` in the output.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2FnrUrlNMVeiKN38QzyUau%2Fimage.png?alt=media&amp;token=754547a4-d24c-4f6b-a208-dbd20451ed9a" alt=""><figcaption><p>Example OPTIONS request</p></figcaption></figure>

### Do a POST request

With the `post` function, you can invoke a `POST` request for updating an existing resource on a server or adding a subsidiary resource to an existing one. POST is not defined as idempotent, meaning that the same request sent multiple times may have different results.

* Insert the URL, including the server path, into the first input box.
* Drag your data into the second input box.

{% hint style="info" %}
You can also drag and drop files from the file manager on the bottom left into the second input field.
{% endhint %}

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2F5tctTRgvNzBBHtvSrkZR%2Fimage.png?alt=media&amp;token=fedd77ac-800c-41de-9ac3-dd42a764b9e4" alt=""><figcaption><p>Creating a new sub-resource with a POST request</p></figcaption></figure>

### Do a PUT request

With the `put` function, you can invoke a `PUT` request for replacing an existing resource on a server or adding a new resource at a new path. PUT is defined as idempotent, meaning that the same request sent multiple times should have the same result, provided the server has implemented PUT correctly.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2Fv9TyXNRrsEACGddHxyA1%2Fimage.png?alt=media&amp;token=6897e425-5a08-4e40-abe8-69b795cbc4ea" alt=""><figcaption><p>Replacing an existing resource with a PUT request</p></figcaption></figure>

### Do a PATCH request

The `patch` function creates a [`PATCH`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) request, with which you can modify a resource on a server. PATCH requests are often omitted in the implementation of the server. You may check if it is supported with the [`options`](#do-an-options-request) function.

<figure><img src="https://3495989837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE5Ketpww1s7TauSAJrJ8%2Fuploads%2F7aycOZRhJ8Pp3qFJIZzd%2Fimage.png?alt=media&amp;token=34276e4c-822d-43cd-b485-855fe592ee68" alt=""><figcaption><p>Modifying an existing resource with a PATCH request</p></figcaption></figure>


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.heisenware.com/~/changes/Q625pQNc0nXqVGPtyjAY/building-apps/integration/protocol-connectors/http-rest.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
