Add

[POST] .../v1/reportbuildertemplate/add

Adds a report builder template for the current user. Use this method to save a new report builder template for the current user. The request stores domain, name, optional description, structure, filters and options. The saved template can later be passed to ReportBuilder/Validate or ReportBuilder/AddRequest by the client. 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 and persistent 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 Object Optional Saved report business filters.
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.

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": {
    "firm_id": 1,
    "stock_ids": [
      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
  }
}