Skip to main content

Connectors

Use the HTTP / REST connector when a Service Task needs to read or write JSON on an external system. The model selects a connector version and a named connection. The server resolves that name to a base URL and, when configured, adds an authentication header.

Download these files into one directory.

The two profiles in this example both use loopback addresses and fake credentials. Start the test inventory simulator with Node.js 26.

Terminal window
INVENTORY_DEMO_SECRET=example-test-only node inventory.ts test

Configure a local Effect server with the same fake credential. Set these variables in the environment of the server process, from the directory containing the downloads.

Terminal window
export GETRIEBE_HTTP_CONNECTIONS="$(cat connections-test.json)"
export INVENTORY_DEMO_SECRET=example-test-only
export GETRIEBE_SQLITE_PATH=:memory:

For a source checkout, build the Effect server once with pnpm -r --filter @getriebe/server... build, then run pnpm start in the Getriebe TypeScript repository with those variables set. For the server image, pass the connection JSON and secret variable to the container and set the base URL to an inventory address reachable from inside it. The loopback addresses in the downloads are for processes running directly on your host.

For a local Modeler checkout, start it with GETRIEBE_DEV_PROXY=http://127.0.0.1:3000 npm run dev. Connect to the demo server as admin / admin. Open stock-reservation.bpmn and select Read stock. Under Selected task, you can see Service implementation set to HTTP / REST (v1), Connection set to inventory, HTTP method set to GET, and Relative path set to stock. Reserve stock uses POST and reservations. To author another task, add input and output mappings by entering an API field name under Input port name or Output port name and selecting a typed process field.

Task Request mapping Response mapping
Read stock Process field productCode (string) → query parameter sku JSON available (boolean) → available
Reserve stock productCode (string) → JSON sku, and quantity (long) → JSON quantity JSON id (string) → reservationId, and JSON reserved (boolean) → reserved

Use Export BPMN to save the diagram and reopen it to check those bindings. Select Validate and deploy on the test server. Use the local server API to start the deployed model from a shell with curl and jq.

Terminal window
api=http://127.0.0.1:3000/api/v1
cookie=$(mktemp)
csrf=$(curl -fsS -c "$cookie" "$api/session/csrf" | jq -er '.csrfToken')
curl -fsS -b "$cookie" -c "$cookie" -H "X-CSRF-Token: $csrf" \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"admin"}' "$api/login" >/dev/null
csrf=$(curl -fsS -b "$cookie" "$api/session/csrf" | jq -er '.csrfToken')
model=$(curl -fsS -b "$cookie" "$api/models" |
jq -er '.items[] | select(.bpmnIdentity.processId == "StockReservation") | .id')
instance=$(curl -fsS -b "$cookie" -H "X-CSRF-Token: $csrf" \
-H 'Content-Type: application/json' \
-d '{"data":{"productCode":"W123","quantity":"2"}}' \
"$api/models/$model/instances" | jq -er '.id')
curl -fsS -b "$cookie" "$api/instances/$instance" | jq '{status,data}'

Read the instance again after the two Service Task attempts complete. It shows status: "completed", available: true, reserved: true and reservationId: "test-W123". The inventory service sees a GET with sku=W123 and one POST with the body {"sku":"W123","quantity":"2"}.

Repeat with a fresh local server and the production simulation.

Terminal window
INVENTORY_DEMO_SECRET=example-production-only node inventory.ts production
Terminal window
export GETRIEBE_HTTP_CONNECTIONS="$(cat connections-production.json)"
export INVENTORY_DEMO_SECRET=example-production-only
export GETRIEBE_SQLITE_PATH=:memory:

Deploy the same exported BPMN and start it with the same process data. The new server sends both operations to the other simulator, sets an Authorization: Bearer … header and records production-W123. The model still names the connection inventory.

Set GETRIEBE_HTTP_CONNECTIONS to a JSON array. Each entry has a unique name, a baseUrl, and optional auth. For authenticated connections, auth.header selects the HTTP header, auth.secretEnv names an environment variable in the server process and auth.format is raw (the default) or bearer. Use an HTTPS base URL for an external production service and supply the environment variable from the deployment’s secret store.

The Modeler reads connection names from the server. The URL, header settings, secret reference and credential are server configuration. A relative path such as stock or v1/reservations is resolved under the configured base path. Deployment rejects absolute URLs, a leading slash, dot segments, percent escapes, queries and fragments. The connector does not follow redirects. Model the request fields as typed inputs to set JSON properties on POST or query parameters on GET.

Response ports select top-level JSON fields by their names. Every declared output must be present and have the BPMN port type. Extra response fields are discarded. Strings, booleans and supported lists use their JSON types. Use JSON strings for exact long and decimal values. A GET repeats a query key for each list item.

In the TypeScript workspace, run:

Terminal window
pnpm example:delivery-reservation

The example starts the local inventory simulator and a disposable Effect server, deploys the same model once, and runs two orders. It uses the inventory connection and posts to delivery-reservations.

Initial slot Inventory response Workflow result
morning HTTP 201 with reservationId Records test-north-morning and continues on the regular path.
closed HTTP 409 with {"code":"slot_closed"} Records DELIVERY_WINDOW_CLOSED and opens Choose another delivery slot. Choosing afternoon starts a new Service Task execution and records test-north-afternoon.

Download the reservation BPMN and reservation XSD. Open them together in the Modeler. Connect to an Effect server with the inventory connection and the local simulator from the previous example.

Select Reserve delivery slot and check its BPMN Operation. The operation declares a request with slotId and warehouseId, a success response with reservationId, and the Error DELIVERY_WINDOW_CLOSED. The interrupting Error Boundary Event uses the same Error declaration.

Under HTTP fault rules, set HTTP status to 409, Response JSON field to code and Exact field value to slot_closed. Select DELIVERY_WINDOW_CLOSED as the Reported BPMN Error. A rule uses a top-level JSON field and an exact string value, including case. Rules for the same status must compare distinct values of the same field. The server validates the rule against the selected operation.

Inspect BPMN Error history in Getriebe Admin to see the faulted attempt and the selected Error Boundary Event. The reservation output is written when an attempt completes through the success response. An unrelated HTTP 409 follows the technical attempt path.

Check the Service Task attempt and the instance’s issues when a request fails. An unsuccessful HTTP status, a transport failure and an invalid response have different diagnostics. The connector omits raw URLs, request and response bodies, headers and exception text from diagnostics.

A POST that may have taken effect can end with state unknown. This includes a lost connection, a redirect, a server error, or a successful status with unusable response data. Getriebe never retries the HTTP call automatically. Before using the explicit retry operation, reconcile a possible write with the external system. The attempt stays visible for review and does not advance the process or set output fields.

See the connector contract for BPMN interchange, connection discovery and runtime details.