Service Task — REST API 🌍
Makes HTTP calls to external REST APIs.
Node type: serviceTask (subtype: REST API)
Category: Integration
Actor: serviceTask (2 threads)
Description
The REST API Service Task sends HTTP requests to external APIs and captures the response as workflow variables. It supports all standard HTTP methods, configurable headers, authentication, and request bodies.
Credentials (base URL, auth tokens) are stored in a REST API Integration — the node only configures the specific endpoint path and request details.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
restApiConnectionId | string | Yes | ID of the REST API integration (base URL + auth config) |
endpointPath | text | Yes | Path appended to the base URL. Supports {varName} references |
method | select | Yes | HTTP method: GET, POST, PUT, PATCH, DELETE |
body | textarea | No | Request body (JSON string). Supports {varName} references |
Inputs
Use {varName} syntax in endpointPath and body:
endpointPath: /customers/{customerId}/orders
method: POST
body: {
"orderId": "{orderId}",
"amount": "{total}",
"currency": "USD",
"customerEmail": "{email}"
}
Outputs
The Service Task captures the HTTP response and stores it as:
| Variable | Type | Description |
|---|---|---|
{serviceTaskResponse} | string/object | The response body (auto-parsed if JSON) |
{serviceTaskStatusCode} | number | HTTP status code (e.g., 200, 404) |
{serviceTaskHeaders} | object | Response headers |
If the response body is valid JSON, individual fields are accessible:
{serviceTaskResponse.id}— accesses theidfield of the JSON response{serviceTaskResponse.data.name}— nested access
Custom Output Variable
You can configure a custom output variable name in the node properties to avoid conflicts when multiple service tasks run in sequence.
Connection Flow
| Condition | Connection Used |
|---|---|
| HTTP 2xx response | successFlow (or sequenceFlow if no success flow defined) |
| HTTP 4xx / 5xx response | errorFlow |
| Request timeout | timeoutFlow |
Example: Fetch Customer Data
{
"nodeId": "fetch-customer-1",
"name": "Fetch Customer Details",
"nodeType": "serviceTask",
"properties": {
"restApiConnectionId": "int_crm_api",
"endpointPath": "/v2/customers/{customerId}",
"method": "GET"
},
"timeout": {
"duration": 10,
"durationUom": "SECONDS",
"action": "FAIL"
},
"retry": {
"maxAttempts": 3,
"delay": 2,
"delayUom": "SECONDS"
}
}
The response is stored as {serviceTaskResponse}. Access fields like {serviceTaskResponse.name}, {serviceTaskResponse.email} in downstream nodes.
Example: Create Order (POST)
{
"nodeId": "create-order-1",
"name": "Create Order in ERP",
"nodeType": "serviceTask",
"properties": {
"restApiConnectionId": "int_erp_api",
"endpointPath": "/orders",
"method": "POST",
"body": "{\"customerId\": \"{customerId}\", \"items\": {orderItems}, \"total\": {orderTotal}}"
}
}
Authentication
Authentication is configured at the Integration level, not the node level:
| Auth Type | How Configured |
|---|---|
| None | No auth header sent |
| Bearer Token | Adds Authorization: Bearer {token} header automatically |
| Basic Auth | Adds Authorization: Basic {base64} header |
| API Key Header | Adds custom header (e.g., X-API-Key: {value}) |
| OAuth2 Client Credentials | Fetches + caches access token before each call |
You can also add static headers at the integration level (e.g., Accept: application/json).
Error Handling
| Scenario | Variable | Value |
|---|---|---|
| HTTP 4xx error | {serviceTaskStatusCode} | 400, 401, 404, etc. |
| HTTP 5xx error | {serviceTaskStatusCode} | 500, 502, 503, etc. |
| Response body on error | {serviceTaskResponse} | Error response body from the API |
| Connection timeout | Takes timeoutFlow | — |
| DNS resolution failure | Takes errorFlow | _error = CONNECTION_ERROR |
Best Practices
- Always configure
successFlowanderrorFlowconnections for production workflows - Set a timeout — external APIs can hang indefinitely without one
- Use retry (2–3 attempts) for idempotent GET requests; be careful with POST/PUT
- Store API base URLs and credentials in integrations, not in node properties
- Use
{serviceTaskStatusCode}in downstream If/Else nodes to handle specific HTTP error codes differently - For APIs that return paginated results, use a Loop node to iterate through pages