Request

Label: :IA_Function
Property: type: Request
Inherits from: Function

Performs an HTTP request to an external url.

Parameters

Key Description Default value Possible values
allowFailure If set to true, a failed request will not throw an error. true/false/1/0
auth.username* Basic authentication username string
auth.password* Basic authentication password string
buffer An object to configure message buffering when responseType is 'stream'. See Stream Buffering. object
data Payload or parameters to send with the request. object or string
download The response will be downloaded as a file true/false
downloadName Downloaded file default name download string
headers Headers to send with the request. object
method HTTP method GET GET/POST/PUT/DELETE/OPTIONS/CONNECT
params Parameters to be encoded into the url object
serverSide Will execute the request from the server. If set to true, url will only be read directly from the Request node, and download will not work. false true/false
showLoaderAfterMs Show a loader if the request takes more time (in milliseconds) than specified Infinity Positive number
timeout Timeout after which to give up the request attempt (in ms) 30000 number
url* Target url to perform the HTTP request to. string (url)
urlData Data to be used for URL templating (server-side only). object
responseType Set to 'stream' to handle the response as a Server-Sent Events (SSE) stream. stream
queueProcessDelay Delay in milliseconds between processing messages in the stream queue. 5 number
finisher A string or a function to determine when a stream is finished. If a string, the stream ends when the data includes the string. If a function, it's called with the data and ends the stream if it returns true. string / function

* When serverSide is set to true, these parameters will be read directly from the Request node and can therefore not be overridden by triggers, use code evaluation nor templating.

Other parameters

This Function is a wrapper for the $.ajax jQuery function. Other than the parameters described above, the following parameters to the $.ajax function are supported (please refer to the jQuery documentation for their use):

  • accepts
  • cache
  • contents
  • contentType
  • converters
  • crossDomain
  • data
  • dataType
  • headers
  • ifModified
  • method
  • mimeType
  • password
  • processData
  • timeout
  • traditional
  • url
  • username
  • xhrFields

Server-Side Requests

When the serverSide parameter is set to true, the Request function is executed on the server. This provides more capabilities and follows a different execution path than the client-side implementation.

URL Templating

The url property of the Request function node can be a template. This allows for creating dynamic URLs.

Example:

If the url on the Request node is https://api.example.com/users/{{userId}}, and the urlData is {"userId": "123"}, the request will be made to https://api.example.com/users/123.

Permissions

The server-side implementation performs the following permission checks:

  • Read Permission: The user must have 'read' permission on the Request function node.
  • Request Permission: The user must have 'request' permission.

Error Response

In case of an error, the server-side execution returns a JSON object with the following structure:

{
  "error": {
    "message": "Error message",
    "response": {
      "status": 404,
      "statusText": "Not Found",
      "data": "..."
    }
  }
}

Content-Type Handling

The server-side implementation has special handling for the following Content-Type headers:

  • application/x-www-form-urlencoded: The data object will be encoded as form data.
  • multipart/form-data: The request will be sent as multipart form data.

Event Streaming

By setting the responseType parameter to stream, the Request function can listen to a Server-Sent Events (SSE) stream. This allows the client to receive continuous updates from a server over a single HTTP connection.

When in streaming mode, the messageReceived, finished, and error triggers can be used. See the Outgoing triggers section for more details.

Stream Buffering

When using responseType: 'stream', you can control the flow of messageReceived triggers by using the buffer parameter. This is useful for batching high-frequency messages to improve performance.

The buffer parameter is an object with the following properties:

Key Description Default value Possible values
messageCount The number of messages to buffer before firing a messageReceived trigger with the combined data. 1 number
timeLimit The maximum time in milliseconds to buffer messages before firing a messageReceived trigger. This acts as a timeout. number

Behavior:

  • If only messageCount is set, a trigger will fire every time the specified number of messages is received.
  • If only timeLimit is set, a trigger will fire when the time limit is reached. The timer starts when the first message arrives in a new batch.
  • If both are set, a trigger will fire as soon as one of the conditions is met (messageCount is reached or timeLimit expires). When a trigger fires, both the counter and the timer are reset.
  • If the stream ends, any messages remaining in the buffer are flushed and sent in a final messageReceived trigger.

Outgoing triggers

Type: success

Fires when the request was successfully completed, and the response was received.

Additional event properties (besides the inherited properties):

Key Description Possible values
completed Indicates that the request was completed true
response The response to the request object
response.status The HTTP status of the request 200
response.statusText The HTTP status text of the request OK
response.data The response data object/string

Type: fail

Fires when the request was completed, but with errors.

Additional event properties (besides the inherited properties):

Key Description Possible values
completed Indicates that the request was completed true
response.status The HTTP status of the request HTTP status codes
response.statusText The HTTP status text of the request HTTP status texts
response.data The response data object/string
response.error The reported error message in the response (if any) string

Type: messageReceived

(Available only when responseType is 'stream')

Fires when a new event (or a batch of buffered events) is received from the stream. Its behavior can be modified by the buffer parameter.

Additional event properties:

Key Description Possible values
data The data chunk received from the stream. string

Type: finished

(Available only when responseType is 'stream')

Fires when the stream is closed. This can happen when the connection is closed by the server, or when the condition defined by the finisher parameter is met.

Additional event properties:

Key Description Possible values
data All data content received during the entire stream session, concatenated into a single string. string

Type: error

(Available only when responseType is 'stream')

Fires when a connection error or any other error occurs during the stream. Note that this is different from the fail trigger, which is for completed HTTP requests that result in an error status code.

Additional event properties:

Key Description Possible values
error The error message or object. string / object

Example

To run this example, copy the JSON configuration below and import it into Graphileon.

{
  "date": "2025-10-10T20:29:14.371Z",
  "nodes": [
    {
      "id": 246,
      "labels": [
        "IA_Function"
      ],
      "properties": {
        "$data": "",
        "template": "<pre>{{data}}</pre>",
        "type": "HtmlView",
        "uuid": "3535c869-07c0-491d-a0b5-086c8edffcb6"
      }
    },
    {
      "id": 245,
      "labels": [
        "IA_Function"
      ],
      "properties": {
        "finisher": "id5",
        "responseType": "stream",
        "type": "Request",
        "url": "https://graphileon.com/sse.php",
        "uuid": "7203fa3e-58c7-4250-a27e-400d4ba7caa7"
      }
    },
    {
      "id": 223,
      "labels": [
        "IA_Function"
      ],
      "properties": {
        "$options.pagination": true,
        "$options.paginationAutoPageSize": true,
        "_instance": "sseaggridview",
        "type": "TableView",
        "uuid": "c2cfd55e-0145-443b-951f-208cb1bf47f6"
      }
    }
  ],
  "relations": [
    {
      "id": 424,
      "source": 245,
      "target": 246,
      "from": "7203fa3e-58c7-4250-a27e-400d4ba7caa7",
      "to": "3535c869-07c0-491d-a0b5-086c8edffcb6",
      "type": "TRIGGER",
      "properties": {
        "$data": "(%).data",
        "type": "finished",
        "uuid": "5c1cb76f-398f-400d-b471-f9a221a691c4"
      }
    },
    {
      "id": 423,
      "source": 245,
      "target": 223,
      "from": "7203fa3e-58c7-4250-a27e-400d4ba7caa7",
      "to": "c2cfd55e-0145-443b-951f-208cb1bf47f6",
      "type": "TRIGGER",
      "properties": {
        "#_update.add.data": "evaluate(fromJSON((%).data))",
        "type": "messageReceived",
        "uuid": "60d27c5d-8c57-4216-9555-2477b4d19b24"
      }
    }
  ]
}