Search

Home

Home

REST API CALL

REST API CALL

The CALL REST API operator enables integration with any external REST service, offering full flexibility in configuring HTTP calls. It can operate either as a single invocation (regardless of the number of records on the data bus) or on individual data bus records, meaning that a separate request is executed for each record, sending the data in the required format and receiving a response.

The operator allows you to:

  • freely construct the service URL using data bus bits, project parameters, or global variables
  • freely define headers, parameters, and request bodies (e.g., JSON, form-data, query string),
  • dynamically insert values from data bus bits and project parameters,
  • select the HTTP method (GET, POST, PUT, DELETE, etc.),
  • handle authorization (Basic, Bearer Token, custom),
  • and map the response to existing data bus bits, including storing returned data and the HTTP status code.

Thanks to this operator, GRAVITY can act as an active client of external services, automating real-time data retrieval, transmission, and synchronization.

An example of a project using the CALL REST API operator:

image

The operator is a counterpart to INPUT REST APIINPUT REST API, and the main configuration details are described for that operator.

However, there are some differences resulting from the fact that this is an intermediate operator connected to the data bus; as a result, processing is triggered by default for each data bus record. In this case, data bus bits can be used to construct both the request body and the address of the called service. Likewise, the data returned by the service, as well as the status code value, are inserted into each data bus record for which the service call was executed. It is also possible to specify pre-prepared bits (for example, created by the WIDTH BUSBARWIDTH BUSBAR ) operator) to store this data.

The Execution tab requires you to specify whether the call should run in Single execution mode (once for all records) or separately for each record. In the Result target field, you can select the Value into an existing column option, which allows you to choose the data bus column where the result returned by the service will be stored. The same applies to the remaining columns.

image
  • When Single execution mode is selected, the operator behaves like the INPUT REST APIINPUT REST API operator. It is executed only once. It returns an output data bus consisting of a single record containing the status code value and the result returned by the service. In this mode, data bus bits cannot be used to construct the service URL, call parameters, or similar elements.
  • The only place where data bus bits can be used is in a raw, request body, where the body sent to the service can be constructed using the LOOP and ENDLOOP markers.

    image

    The text inside these markers will be repeated as many times as there were records on the input data bus.

  • When the call is executed for each record, data bus bits can be used to build the service URL, parameters, and request body.
  • image

    The service will be called as many times as there are records on the input data bus, and the result of each call will be written to the bits specified on the Execution tab.

    image
    icon
    See how to run a project in debug mode.