Validate

[POST] .../v1/reportbuilder/validate

Validates a report builder draft. Use this method to check a draft before creating a queued builder report. The method does not create a report request or processing task. The API validates firm_id and stock_ids against the current user's available warehouses before checking the draft. A semantically invalid draft is returned as ok=true with result.valid=false so the client can display all validation issues. The caller must have report-builder permission 759 and an account tariff with report builder enabled; missing body, denied access, unavailable tariff, invalid firm or stock filters, builder service connectivity errors and malformed builder responses are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
domain String Required Report builder domain code, for example Nomenclature.
filters Object Optional Report business filters. Values may be numbers, strings, booleans, arrays or objects.
name String Optional User-visible report name.
options Object Optional Report rendering and calculation options keyed by codes returned in schema.options.
structure ReportBuilderStructure Required Selected report table structure.

Request Example

{
  "domain": "Nomenclature",
  "name": "Stock by warehouse",
  "structure": {
    "row_groups": [
      "item_group.name",
      "item.name"
    ],
    "row_columns": [
      "item.code",
      "unit.name"
    ],
    "column_groups": [
      "stock.name"
    ],
    "metrics": [
      "stock_balance.current_quantity",
      "stock_balance.stock_cost_amount"
    ]
  },
  "filters": {
    "firm_id": 1,
    "stock_ids": [
      1,
      2
    ],
    "date": 1798732800,
    "currency_id": 1
  },
  "options": {
    "include_totals": true
  }
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result ReportBuilderValidationResult Result object.

Response Example

{
  "ok": true,
  "result": {
    "valid": true,
    "errors": [],
    "warnings": [],
    "required_filters": [
      "firm_id",
      "date",
      "currency_id"
    ],
    "resolved_data_plan": {
      "result_grain": [
        "item.id",
        "stock.id"
      ],
      "metric_sources": [
        "StockBalance"
      ],
      "source_grains": {
        "StockBalance": [
          "item.id",
          "stock.id",
          "date"
        ]
      },
      "column_group": {
        "field": "stock.name",
        "group_key": "stock.id",
        "compatible_sources": [
          "StockBalance"
        ]
      },
      "lookups": [
        "item",
        "stock"
      ],
      "notes": []
    }
  }
}