How to get script report filters using api

How do I get the filters that are required when querying a report, using the ERP Next R.E.S.T. A.P.I.s?

Filter syntax is very similar to get_list filter syntax. It’s just key-value pair for fieldname and values.

POST /api/method/frappe/desk/query_report
{
    "report_name": "General Ledger",
    "filters": {
        "company": "Wind power",
        "from_date": "2022-11-15",
        "to_date":"2022-12-15",
        "group_by": "Group by Voucher (Consolidated)",
        "include_dimensions":1
    },
    "ignore_prepared_report": True, // if you want to explictly regenerate report
}

You can intercept a request when you generate report and see exactly what frappe is doing.

I want an API that will return the filters, because there are situations, I don’t know which filters to pass, so I want an API that will return a list of all possible filters for a report name.

I doubt this is easily possible. Columns can be dynamically added/removed in reports. :sweat_smile:

Only source of truth would be code in this case. report.js files would contain column names and column types in most cases. You can’t query them though.

I noticed that they are actually being passed via a js file, here is an example