AddRequest

[POST] .../v1/reportbuilder/addrequest

Queues a validated report builder draft. Run a builder report; it is the only supported public entry point for builder report creation. The API validates report-builder permission 759, account tariff, disk-space quota and the unified Field/Operator/Value filter array against GetSchema. Company and warehouse access is checked when declared by the domain schema; Crm and WorkTime do not require firm_id. If stock_id is omitted in a warehouse-scoped domain and the user is warehouse-restricted, the request is limited to available warehouses in the selected company. The method validates the draft, stops without creating a task when result.valid=false, creates a queued report request for a valid draft, schedules preparation and returns Insert_uuid_Result with new_uuid. The queued request status is read through Report/GetRequest and the prepared builder result is read through ReportBuilder/GetPrepared. Missing body, denied access, unavailable tariff, invalid filter fields, operators, values or company/warehouse access, invalid builder drafts, builder service errors, queue limits, quota errors and storage errors are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
domain String Required Report builder domain code, for example Nomenclature.
filters Array of Filter Optional Report filters using Field, Operator and string Value. Allowed fields and operators come from GetSchema. In values are comma-separated; dates use Unix seconds. Specify each field once.
name String Optional User-visible report name.
options Object Optional Options keyed by schema.options codes. Use JSON booleans, numbers or allowed enum strings. Omitted active values use schema defaults; inactive values are ignored. Validate returns availability and effective_parameters.
structure ReportBuilderStructure Required Selected 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",
  "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": [
    {
      "Field": "firm_id",
      "Operator": "Equal",
      "Value": "1"
    },
    {
      "Field": "stock_id",
      "Operator": "In",
      "Value": "1,2"
    },
    {
      "Field": "date",
      "Operator": "Equal",
      "Value": "1798732800"
    },
    {
      "Field": "currency_id",
      "Operator": "Equal",
      "Value": "1"
    }
  ],
  "options": {
    "include_totals": true
  }
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert_uuid Created UUID record result.

Response Example

{
  "ok": true,
  "result": {
    "new_uuid": "f20c8f37-8bcb-4f7c-8dc5-8b0b2f4f0c11"
  }
}