Add
[POST] .../v1/reportbuildertemplate/add
Adds a report builder template for the current user. Save a new report builder template for the current user. The request stores domain, name, optional description, structure, filters and options. Filters use the shared Field/Operator/Value array and are normalized against GetSchema before storage. Each provided filter must use a supported field and operator with a valid literal value; In values are comma-separated and dates use Unix seconds. Required report filters may be omitted in a template and filled before Validate or AddRequest. Only the current user can read, edit or delete the created template. This method requires billing db version 406 or later and an account tariff with report builder enabled; older account databases return ErrorResult 1008 and disabled tariff returns ErrorResult 7501. The caller must have report-builder permission 759; missing body, denied access, unavailable tariff, invalid fields, oversized template payload, unavailable domain schema and storage errors are returned as HTTP 200 ErrorResult.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| description | String | Optional | Optional template description. |
| domain | String | Required | Report builder domain code. |
| filters | Array of Filter | Optional | Saved report filters using Field, Operator and string Value. In values are comma-separated; dates use Unix seconds. |
| name | String | Required | User-visible template name. |
| options | Object | Optional | Saved report rendering and calculation options keyed by codes returned in schema.options. |
| structure | ReportBuilderStructure | Required | Saved report table structure. |
Filterable Fields
Load the available filter fields and operators from POST /reportbuilder/getschema using the same domain value. Read the returned result.filters metadata.
Request Example
{
"domain": "Nomenclature",
"name": "Stock by warehouse",
"description": "Current stock balance grouped by item and warehouse.",
"structure": {
"row_groups": [
"item_group.name",
"item.name"
],
"row_columns": [
"item.code",
"unit.name"
],
"column_groups": [
"stock.name"
],
"metrics": [
"stock_balance.current_quantity"
]
},
"filters": [
{
"Field": "firm_id",
"Operator": "Equal",
"Value": "1"
},
{
"Field": "stock_id",
"Operator": "In",
"Value": "1,2"
}
],
"options": {
"include_totals": true
}
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 10
}
}