Skip to main content

GET epm_value

Returns one financial value for an entity, year, period and account.

Endpoint​

GET /api/method/konsol.api.epm_value

The decorator is @frappe.whitelist() with no verb restriction, so POST with form or JSON arguments works too. For many values use epm_batch; the Excel add-in only calls epm_batch.

Authentication: logged-in user (session cookie or X-Konsolidat-Token). The caller must be allowed to see entity (User Permissions on Entity); otherwise PermissionError (HTTP 403).

Parameters​

Query-string arguments. Source: the signature of epm_value in konsol/api.py.

ParameterTypeRequiredDefaultDescription
entitystringYes—Entity code (e.g. USMF)
yearintegerYes—Fiscal year (e.g. 2024)
periodstring or intYes—A period token of that year's declared calendar; see Period resolution
accountstringYes—Main account code (e.g. 401100)
measurestringNothe Dataset's default_measureMeasure name. Must be in the Dataset's measures and Published in the Measure registry. A Dataset with no default_measure refuses a blank measure and lists its measures.
factstringNo—Dataset fact_name (case-insensitive). Selects the source table. Wins over scenario when both are given.
scenariostringNoactualsResolves the Dataset by scenario_key when fact is not given
dimensionsstring (JSON object)No{}Dimension filters, e.g. {"dim_region":"EU","dim_product":"X"}. Keys are dimension names declared on the Dataset. The only way to filter by dimension. Must parse as a JSON object.
scenario_idstringNo""Filter to one budget scenario (e.g. BUDGET_2025). Applies to Datasets with has_scenario_id.
layerstringNo""Budget layer filter (base, challenge, management, board) for Datasets with has_layer
hierarchystringNo—Reporting Hierarchy name, for a hierarchy read (see below)
node or hierarchy_nodestringNo—A Reporting Hierarchy member code. When set, the read is a hierarchy read.

Datasets, measures and dimensions are registry records (doctypes Dataset, Measure, Dimension). There is no table map in the code: fact or scenario resolves to Dataset.clickhouse_table.

Period resolution​

Period tokens resolve against the calendar declared for year in EPM Fiscal Year (konsol/period_read_model.py, konsol#251). There is no fixed 1–12 table in the code, so a 13-period or 4-4-5 year is read as declared.

TokenResolves to
A period number (7, 13, 0) or period code (P07, CLS, OPN)That one declared period
Q1..Q4The Regular periods declared in that quarter
H1, H2Q1+Q2, Q3+Q4
FYEvery Regular period of the year

A token that resolves to several periods returns the sum across them. A token that is not declared is refused with a ValidationError that names the declared set. A year with no declared calendar is refused with "No fiscal periods are declared for this year".

Hierarchy reads​

When node (or hierarchy_node) is given, the value is read from the hierarchy gold tables for that Reporting Hierarchy member instead of a flat entity table. hierarchy may be blank only when exactly one Published hierarchy holds the node; a node found in several is refused with their names. A blank measure takes the default measure of the Dataset registered for the scenario. entity may be a wildcard (*, ALL or blank), which is limited to the caller's allowed entities.

Response​

{
"message": {
"value": 125430.50
}
}

No matching rows gives 0.0.

Examples​

Net amount for one month​

curl "http://localhost:8069/api/method/konsol.api.epm_value?\
entity=USMF&year=2024&period=5&account=401100" \
-b "cookies.txt"

Budget, one quarter, named measure​

curl "http://localhost:8069/api/method/konsol.api.epm_value?\
entity=USMF&year=2025&period=Q1&account=6100&\
measure=period_amount&scenario=budget&scenario_id=BUDGET_2025" \
-b "cookies.txt"

Dimension filters​

# dimensions is a URL-encoded JSON object: {"dim_region":"EU","dim_product":"X"}
curl "http://localhost:8069/api/method/konsol.api.epm_value?\
entity=USMF&year=2024&period=FY&account=401100&\
dimensions=%7B%22dim_region%22%3A%22EU%22%2C%22dim_product%22%3A%22X%22%7D" \
-b "cookies.txt"

Dataset by name​

curl "http://localhost:8069/api/method/konsol.api.epm_value?\
entity=USMF&year=2024&period=FY&account=401100&\
fact=headcount&measure=driver_value" \
-b "cookies.txt"

Errors​

All are ValidationError (HTTP 417) unless stated. The allowed lists are built from the registry at request time.

MessageCause
Invalid fact '{x}'. Allowed: ...No Dataset with that fact_name
Invalid scenario '{x}'. Allowed: ...No Dataset with that scenario_key
Fact '{x}' declares no Default Measure, so a read must name one. Its measures are: ...Blank measure, Dataset without default_measure
Invalid measure '{m}' for fact '{x}'. Allowed: ...Measure not allowed by the Dataset or not Published
Invalid dimension '{d}' for fact '{x}'. Allowed: ...Dimension not declared on the Dataset
dimensions must be a JSON objectdimensions did not parse as an object
text naming the declared periodsperiod not in the year's declared calendar
Not permitted to access entity '{e}' (PermissionError, 403)Entity outside the caller's allow-list
budget-scenario or ClickHouse messagesA refused read (for example no, or several, active budget scenarios; konsol#214) is thrown rather than returned as an empty cell

Notes​

  • epm_value and epm_batch share _resolve_and_validate and _batch_query_clickhouse, so the same request gives the same value either way.
  • period accepts an integer or a string; "5" and 5 are the same token.