Inputs
Endpoints for managing template inputs. Inputs define user parameters that can be provided when rendering a template.
Input Overview
Input types include:
- text - Single-line text
- textarea - Multi-line text
- number - Numeric value
- date - Date picker
- datetime - Date and time picker
- select - Dropdown list
- multiselect - Multiple selection list
- checkbox - Boolean value
- radio - Radio button group
- dataset - Dataset picker
- datasource - Datasource picker
Inputs can have:
- Default values
- Required validation
- Multiple value support
- Custom help text
- Type-specific configuration in
defnobject
GET /api/templates/{id}/inputs
Get all inputs for a template.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id)
Response:
{
"_links": {
"self": { "href": "/api/templates/{id}/inputs" }
},
"_embedded": {
"inf:template-input": [
{
"id": "input-123",
"templateId": "abc123",
"name": "report_title",
"label": "Report Title",
"driver": "text",
"dataType": "string",
"required": true,
"multiple": false,
"defaultValue": "Monthly Report",
"help": "Enter the title for this report",
"index": 0,
"defn": {}
},
{
"id": "input-456",
"templateId": "abc123",
"name": "start_date",
"label": "Start Date",
"driver": "date",
"dataType": "date",
"required": true,
"multiple": false,
"defaultValue": null,
"index": 1,
"defn": {
"format": "YYYY-MM-DD"
}
}
]
},
"start": 0,
"count": 2,
"total": 2
}
POST /api/templates/{id}/inputs
Add an input to a template.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id), permission.template.write(pre.template)
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
dataType | string | Yes | Data type: string, number, boolean, date, etc. |
driver | string | Yes | Input driver type (text, select, date, etc.) |
name | string | Yes | Variable name (used in template) |
label | string | Yes | Display label for users |
defn | object | No | Driver-specific configuration |
help | string | No | Help text displayed to users |
defaultValue | any | No | Default value |
required | boolean | No | Mark as required (default: false) |
multiple | boolean | No | Allow multiple values (default: false) |
Example Request:
{
"dataType": "string",
"driver": "select",
"name": "region",
"label": "Region",
"required": true,
"multiple": false,
"defn": {
"options": [
{ "value": "north", "label": "North" },
{ "value": "south", "label": "South" },
{ "value": "east", "label": "East" },
{ "value": "west", "label": "West" }
]
},
"help": "Select the region for this report"
}
Response:
Returns the created input object with 201 Created status and Location header.
GET /api/templates/{id}/inputs/{input}
Get a specific input.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id)
Response:
{
"id": "input-123",
"templateId": "abc123",
"name": "report_title",
"label": "Report Title",
"driver": "text",
"dataType": "string",
"required": true,
"multiple": false,
"defaultValue": "Monthly Report",
"help": "Enter the title for this report",
"index": 0,
"defn": {}
}
PUT /api/templates/{id}/inputs/{input}
Update an input configuration.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id), permission.template.write(pre.template)
Request Body:
| Field | Type | Description |
|---|---|---|
driver | string | null | Input driver type |
defn | object | null | Driver-specific configuration |
name | string | Variable name (required) |
label | string | null | Display label |
help | string | null | Help text (empty string allowed) |
defaultValue | any | null | Default value |
required | boolean | Mark as required (default: false) |
multiple | boolean | Allow multiple values (default: false) |
Example Request:
{
"name": "report_title",
"label": "Custom Report Title",
"defaultValue": "Q1 Report",
"required": false
}
Response:
Returns the updated input object.
DELETE /api/templates/{id}/inputs/{input}
Remove an input from a template.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id), permission.template.edit(pre.template)
Response:
Returns 204 No Content on successful deletion.
POST /api/templates/{id}/_input-order
Reorder inputs by updating their index values.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id), permission.template.write(pre.template)
Request Body:
Array of input IDs in desired order.
Example Request:
["input-456", "input-123", "input-789"]
Response:
Returns success confirmation after reordering inputs.
GET /api/templates/{id}/input-locks
Get locked input values for a template (prevents users from changing certain inputs).
Authentication: Required (session)
Pre-blocks: template.lookup(params.id)
Response:
{
"locks": {
"region": "north",
"year": 2024
}
}
PUT /api/templates/{id}/input-locks
Set locked input values for a template.
Authentication: Required (session)
Pre-blocks: template.lookup(params.id), permission.template.write(pre.template)
Request Body:
Object mapping input names to locked values.
Example Request:
{
"region": "north",
"year": 2024
}
Response:
Returns the updated input locks object.