Lemline documentation Help

HTTP Protocol Reference

This reference describes how Lemline executes call: http tasks: which arguments are supported, how requests are built, and what the task returns.

HTTP Support Overview

Feature

Support

Methods

Any HTTP method (get, post, put, patch, delete, ...)

URL

Plain URL or runtime expression

Headers and query parameters

Map of values or a runtime expression returning an object

Request body

JSON, sent for post, put and patch

Authentication

basic and bearer (inline or via use.authentications)

Output

content (default), response or raw

Redirects

redirect: true follows redirects

Not supported: URI template placeholders, connection definitions, form or multipart bodies, OAuth 2.0 and other authentication schemes, per-call timeouts, proxies, cookies, HTTP-level circuit breakers, and runner settings to tune the HTTP client.

Basic HTTP Request

document: dsl: '1.0.3' namespace: examples name: basic-http-request version: '1.0.0' do: - fetchCustomer: call: http with: method: get endpoint: http://127.0.0.1:8787/customers/C-100

URL Construction

Plain URL

document: dsl: '1.0.3' namespace: examples name: http-literal-endpoint version: '1.0.0' do: - fetch: call: http with: method: get endpoint: http://127.0.0.1:8787/customers/C-100

Runtime Expression

document: dsl: '1.0.3' namespace: examples name: http-expression-endpoint version: '1.0.0' do: - fetch: call: http with: method: get endpoint: ${ "http://127.0.0.1:8787/customers/" + .customer.id }

The expression must return a string. RFC 6570 placeholders such as {userId} are not expanded: build dynamic URLs with an expression.

Request Headers

document: dsl: '1.0.3' namespace: examples name: http-request-headers version: '1.0.0' do: - fetch: call: http with: method: get endpoint: http://127.0.0.1:8787/stock headers: Accept: application/json X-Request-Id: ${ .requestId }

headers can also be a single runtime expression that returns an object. Every value is sent as a string.

Query Parameters

document: dsl: '1.0.3' namespace: examples name: http-query-parameters version: '1.0.0' do: - fetch: call: http with: method: get endpoint: http://127.0.0.1:8787/products query: page: "1" category: ${ .category }

Query parameters are appended to the URL. Like headers, query can be a runtime expression returning an object.

Request Body

document: dsl: '1.0.3' namespace: examples name: request-body version: '1.0.0' do: - createCustomer: call: http with: method: post endpoint: http://127.0.0.1:8787/customers body: name: ${ .name } email: ${ .email }

The body is serialized as JSON and sent with Content-Type: application/json. It is only sent for post, put and patch.

Response Handling

Output Formats

output

Task result

content (default)

The response body: parsed JSON when the response content type contains json, a string when it contains text, otherwise the body encoded in Base64

response

An object with request (method, uri, headers), statusCode, headers and content

raw

The response body encoded in Base64

document: dsl: '1.0.3' namespace: examples name: output-formats version: '1.0.0' do: - fetchProducts: call: http with: method: get endpoint: http://127.0.0.1:8787/products output: response output: as: '${ { status: .statusCode, ids: [.content.items[].id] } }'

Error Status Handling

A response whose status is not 2xx makes the task fail with a communication error. Its status is the HTTP status and its title contains the status code and the response body (for example HTTP 404: ...). A call that gets no response (unknown host, refused connection, timeout) also fails with a communication error, with status 500 and a title naming the server (for example Unable to reach https://api.example.com: unresolved host). Catch them with try, and add status to the filter to handle one status only:

document: dsl: '1.0.3' namespace: examples name: error-status-handling version: '1.0.0' do: - fetchData: try: - callApi: call: http with: method: get endpoint: ${ "http://127.0.0.1:8787/products/" + .productId } catch: errors: with: type: https://open-workflow-specification.org/spec/1.0.0/errors/communication as: apiError do: - fallback: set: data: [] reason: ${ $apiError.title }

Authentication

Authentication fields evaluate runtime expressions, so they can read secrets. A workflow only sees the secrets it declares in use.secrets; an undeclared secret evaluates to null and the task faults.

Basic Authentication

document: dsl: '1.0.3' namespace: examples name: http-inline-basic-authentication version: '1.0.0' use: secrets: - API_USER - API_PASSWORD do: - fetch: call: http with: method: get endpoint: uri: http://127.0.0.1:8787/partner/stock authentication: basic: username: ${ $secrets.API_USER } password: ${ $secrets.API_PASSWORD }

Bearer Token

document: dsl: '1.0.3' namespace: examples name: http-inline-bearer-token version: '1.0.0' use: secrets: - API_TOKEN do: - fetch: call: http with: method: get endpoint: uri: http://127.0.0.1:8787/partner/stock authentication: bearer: token: ${ $secrets.API_TOKEN }

Named Authentication

document: dsl: '1.0.3' namespace: examples name: named-authentication version: '1.0.0' use: secrets: - API_TOKEN authentications: apiAuth: bearer: token: ${ $secrets.API_TOKEN } do: - callApi: call: http with: method: get endpoint: uri: http://127.0.0.1:8787/partner/stock authentication: use: apiAuth

An API key can be sent as a regular header. OAuth 2.0 is not supported yet: a task using it fails with a runtime error titled Unsupported OAuth2 authentication.

Redirects

document: dsl: '1.0.3' namespace: examples name: http-follow-redirects version: '1.0.0' do: - fetch: call: http with: method: get endpoint: http://127.0.0.1:8787/old-stock redirect: true

Without redirect: true, a redirect response (3xx) is not followed and fails the task like any other non-2xx status, as in the example below.

document: dsl: '1.0.3' namespace: examples name: http-no-redirect version: '1.0.0' do: - fetch: call: http with: method: get endpoint: http://127.0.0.1:8787/old-stock

Timeouts

The runner's HTTP client uses fixed limits: 15 seconds to connect, 30 seconds for the whole request and 30 seconds of socket inactivity. They cannot be changed, and a task-level timeout is not applied to HTTP calls.

Retry Behavior

HTTP calls are not retried automatically. Use try with retry:

document: dsl: '1.0.3' namespace: examples name: retry-behavior version: '1.0.0' do: - fetchData: try: - callApi: call: http with: method: get endpoint: http://127.0.0.1:8787/stock query: fail: '503' failTimes: ${ .failures // 0 | tostring } key: ${ $workflow.id } catch: errors: with: type: https://open-workflow-specification.org/spec/1.0.0/errors/communication retry: delay: seconds: 2 backoff: exponential: {} limit: attempt: count: 5

HTTP Request Examples

JSON POST Request

document: dsl: '1.0.3' namespace: examples name: json-post-request version: '1.0.0' do: - createReservation: call: http with: method: post endpoint: http://127.0.0.1:8787/reservations headers: Idempotency-Key: ${ .orderId } body: orderId: ${ .orderId } items: ${ .items } output: response

GraphQL Query

document: dsl: '1.0.3' namespace: examples name: customer-graphql-lookup version: '1.0.0' do: - queryGraphQL: call: http with: method: post endpoint: http://127.0.0.1:8787/graphql body: query: "query($id: ID!) { customer(id: $id) { name email } }" variables: id: ${ .customerId }

Run the Examples

Every example on this page is a complete workflow that calls the tutorial shop. Complete the SQLite setup, save each example under the file name used below, and start the shop from the root of the Lemline source checkout:

docker compose -f examples/tutorial-services/compose.yaml up -d

The authentication examples read the shop's demo credentials from secrets. Stop the setup worker with Ctrl+C, export them, and start the worker again (with the JAR, substitute java -jar lemline.jar for bin/lemline):

export API_USER='demo' export API_PASSWORD='demo-password' export API_TOKEN='demo-token' bin/lemline listen --debug

From a second terminal in the setup directory, register and start each example:

bin/lemline definition post -f basic-http-request.yaml bin/lemline instance start examples basic-http-request bin/lemline definition post -f http-literal-endpoint.yaml bin/lemline instance start examples http-literal-endpoint bin/lemline definition post -f http-expression-endpoint.yaml bin/lemline instance start examples http-expression-endpoint --input '{"customer":{"id":"C-200"}}' bin/lemline definition post -f http-request-headers.yaml bin/lemline instance start examples http-request-headers --input '{"requestId":"REQ-42"}' bin/lemline definition post -f http-query-parameters.yaml bin/lemline instance start examples http-query-parameters --input '{"category":"home"}' bin/lemline definition post -f request-body.yaml bin/lemline instance start examples request-body --input '{"name":"Hedy Lamarr","email":"hedy@example.com"}' bin/lemline definition post -f output-formats.yaml bin/lemline instance start examples output-formats bin/lemline definition post -f error-status-handling.yaml bin/lemline instance start examples error-status-handling --input '{"productId":"SKU-404"}' bin/lemline definition post -f http-inline-basic-authentication.yaml bin/lemline instance start examples http-inline-basic-authentication bin/lemline definition post -f http-inline-bearer-token.yaml bin/lemline instance start examples http-inline-bearer-token bin/lemline definition post -f named-authentication.yaml bin/lemline instance start examples named-authentication bin/lemline definition post -f http-follow-redirects.yaml bin/lemline instance start examples http-follow-redirects bin/lemline definition post -f http-no-redirect.yaml bin/lemline instance start examples http-no-redirect bin/lemline definition post -f retry-behavior.yaml bin/lemline instance start examples retry-behavior --input '{"failures":2}' bin/lemline definition post -f json-post-request.yaml bin/lemline instance start examples json-post-request --input '{"orderId":"ORD-1601","items":[{"id":"SKU-1","quantity":1}]}' bin/lemline definition post -f graphql-query.yaml bin/lemline instance start examples customer-graphql-lookup --input '{"customerId":"C-100"}'

Example

Expected result

basic-http-request, http-literal-endpoint

Customer C-100, Ada Lovelace

http-expression-endpoint

Customer C-200, Alan Turing

http-request-headers

The stock; the shop's request list shows x-request-id: REQ-42

http-query-parameters

The home products, SKU-4 and SKU-5

request-body

The new customer C-901

output-formats

{"status":200,"ids":["SKU-1","SKU-2","SKU-3"]}

error-status-handling

{"data":[],"reason":"HTTP 404: …"}

http-inline-basic-authentication

The partner stock with "authenticatedWith":"basic"

http-inline-bearer-token, named-authentication

The partner stock with "authenticatedWith":"bearer"

http-follow-redirects

The stock, read from /stock after the 301

http-no-redirect

Faults with a communication error, status 301

retry-behavior

The stock after two retries

json-post-request

The full response, statusCode 200 with the reservation in content

customer-graphql-lookup

{"data":{"customer":{…"name":"Ada Lovelace"…}}}

Stop the shop when you are done:

docker compose -f examples/tutorial-services/compose.yaml down
25 November 2026