Input & Request Data (WIP)
The input_type field in http defines how your endpoint receives data. All input — whether from a request body or query parameters — is accessible in Lark and Expr steps via input.field_name.
input_type
http:
uri: users/create
method: post
version: 0.1
input_type: json
| Value | Description |
|---|---|
json | Request body is JSON — Content-Type: application/json |
form | Request body is URL-encoded form data — Content-Type: application/x-www-form-urlencoded |
multipart | Request body is multipart form — Content-Type: multipart/form-data |
Accessing Input in Steps
Use input.field_name in any Lark or Expr step to read values from the request:
- expr: build_query
code: |
{
"user_id": input.user_id,
"email": input.email
}
- lark: validate
code: |
user_id = input.user_id
email = input.email
result = {"id": user_id, "email": email}
GET — Query Parameters
For GET requests, input maps to query parameters:
GET /lbl/crm/users/find?version=0.1&user_id=123&status=active
input.user_id # → "123"
input.status # → "active"
input.version # → "0.1"
Pass these directly into SQL via parameter binding:
logic:
- sql: |
SELECT * FROM users WHERE id = ?:user_id AND status = '?:status'
POST / PUT / PATCH — Request Body
For POST, PUT, and PATCH requests, input maps to the request body fields:
curl -X POST "https://your-domain.com/lbl/crm/users/create?version=0.1" \
-H "Content-Type: application/json" \
-H "X-Org-Id: ..." \
-H "X-Project-Id: ..." \
-H "X-Space-Id: ..." \
-H "X-User-Id: ..." \
-H "X-User-Roles: admin" \
-d '{"name": "Alice", "email": "alice@example.com"}'
input.name # → "Alice"
input.email # → "alice@example.com"
Bind directly into SQL:
logic:
- sql: |
INSERT INTO users VALUES(?:id, '?:name', '?:email', now('UTC'))
omit: true
Combining Input with Step Results
input is available in every step alongside step_N:
logic:
# step_0: look up org using input value
- sql: |
SELECT * FROM orgs WHERE id = ?:org_id
omit: true
# step_1: combine input + step_0 result
- expr: build_response
code: |
{
"requested_by": input.user_id,
"org_name": step_0["name"],
"org_id": input.org_id
}
Form and Multipart Input
For input_type: form and input_type: multipart, input.field_name works identically — Minimal normalises all input types into the same input object before executing logic steps.
# form
curl -X POST "https://your-domain.com/lbl/crm/upload?version=0.1" \
-H "Content-Type: application/x-www-form-urlencoded" \
... \
-d "name=Alice&email=alice@example.com"
input.name # → "Alice"
input.email # → "alice@example.com"