# CALLURL

#### Syntax

**CALLURL**(url; *method*; *body*; *header*)

* *url* - the url to which the request is sent - ***Value type**: text*
* *method* - the http request method ("GET", "POST", "DELETE", ...) - ***Value type**: text (optional, default: "GET")*
* *body* - the body data of the http request - ***Value type**: text (optional, default: empty)*
* *header* - the header of the http request - ***Value type**: text (optional, default: empty)*

#### Remarks

* The function returns the result of the http request as text.
* If the url request returns any mime type other than text/…, application/javascript, application/json, application/xml, the function returns !ERROR.

#### Linking the CALLURL function with a database widget

It is possible to use an authentication for the CALLURL function that is stored in a REST or Essbase connection. This allows requests to be sent directly to a REST api with corresponding authentication or to the REST api of an Essbase server, for example.

The widget for which the connection is defined is stored as a reference in the connection formula.

#### Example 1

After clicking on the CallURL button, the url from the top cell widget is sent, and the result is assigned to the bottom cell.

<figure><img src="https://3148043601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL43fiRbeRtPnTjMpbGNO%2Fuploads%2Fgit-blob-2a95687516e839d2bc238f2724ef365acdb1372e%2Fgrafik%20(334).png?alt=media" alt=""><figcaption></figcaption></figure>

In this example, a post request is sent to a url, including body and header information.

<figure><img src="https://3148043601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL43fiRbeRtPnTjMpbGNO%2Fuploads%2Fgit-blob-2a8cd24ba6194ba58ee6012462b884c964ac042f%2Fgrafik%20(142).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Example 2 - ChatGPT Communication

The "CALLURL" button uses the "REST api" button as a reference in the connection formula. When a request is sent with the CALLURL function, the authentication of the connection is used, in this case a bearer token (which is required by ChatGPT).

<figure><img src="https://3148043601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL43fiRbeRtPnTjMpbGNO%2Fuploads%2Fgit-blob-7f2a06eb0b24d19952b72be91b28f99ac7323245%2Fgrafik%20(26).png?alt=media" alt=""><figcaption><p>The CALLURL button references the REST api button in its Connection formula</p></figcaption></figure>

<figure><img src="https://3148043601-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL43fiRbeRtPnTjMpbGNO%2Fuploads%2Fgit-blob-c735e745a35acf37f4aaaa62b906b7ccee9a20a0%2Fgrafik%20(27).png?alt=media" alt=""><figcaption><p>The query can then be sent using the CALLURL function</p></figcaption></figure>
