Models Endpoint

A model tells Engeene which datasets you have, which properties each one holds and how the datasets link to each other. This page covers reading every model you can access (start here before writing a query), the model definition you write, and saving it — including which changes are safe once data is loaded.

Method Path Description Permission
GET /models Every model, dataset and property you can access —
GET /model-editor/{model} One model's definition model:view
POST /model-editor/{model} Create or replace a model with the definition in the body model:edit
DELETE /model-editor/{model} Delete a model model:edit

You can also write a model in the Model Editor, or import it from another BI tool — GoodData, Looker, Tableau, Power BI, Qlik, dbt, Cube, Superset or Metabase (see Importing from another BI tool).

Reading the models

Method: GET Path: /models Authentication: Required

Response

{
  "models": [
    {
      "name": "ecommerce",
      "displayName": "E-Commerce",
      "description": "Online store orders and customers",
      "references": [
        { "column": "customerId", "dataset": "customers" }
      ],
      "datasets": [
        {
          "name": "orders",
          "displayName": "Orders",
          "reachableDatasets": ["customers", "products"],
          "references": [
            { "column": "customerId", "target": "customers" }
          ],
          "attributeColumns": [
            { "name": "category", "displayName": "Category", "collection": "category" },
            { "name": "orderId", "displayName": "Order ID", "isId": true, "collection": "orderId" }
          ],
          "measureColumns": [
            { "name": "revenue", "displayName": "Revenue", "scale": 100 },
            { "name": "quantity" },
            { "name": "orderedAt_date", "timeParent": "orderedAt", "displayName": "Ordered At (Date)" },
            { "name": "orderedAt_time", "timeParent": "orderedAt", "displayName": "Ordered At (Time)" }
          ],
          "timeColumns": [
            { "name": "orderedAt", "displayName": "Ordered At" }
          ]
        }
      ]
    }
  ]
}

In a query, a property is named dataset.property from these ids — orders.revenue, customers.country.

Model entries

Field Type Description
name String Model id, used in API paths
displayName String Display name (optional)
description String One-line description (optional)
references Array Every Reference property of the model, with its target dataset
datasets Array The model's datasets

Dataset entries

Field Type Description
name String Dataset id
displayName String Display name (optional)
reachableDatasets Array Datasets this one links to, directly or through others — what a query starting here can combine
references Array This dataset's Reference properties: column (the property) and target (the dataset it points at)
attributeColumns Array Attribute, ID and Reference properties — for grouping and filtering
measureColumns Array Measure properties — for aggregation
timeColumns Array Time properties — for time filters and grouping

A dataset may also carry rowCount and lastUpdated (epoch milliseconds of its latest data point), but on your workspace address they are usually absent — read a dataset's row count from the Info Endpoint. Neither is ever present for a model your role limits by row, or in an embedded view: a total over every row would say how much data the limit keeps from you.

Attribute entries

Field Type Description
name String Property id
displayName String Display name (optional)
isId Boolean true for the dataset's ID property — Count it to count rows
isSet Boolean true for a multi-value property (Set of Attributes)
collection String Where the property's values are kept — pass it to the attribute endpoints to turn values into identifiers and back

Measure entries

Field Type Description
name String Property id
displayName String Display name (optional)
scale Number Decimal scale (100 = two decimal places); omitted when 1
defaultAggregation String The aggregation the model suggests, spelled as the query endpoint accepts it (Average); omitted when none
timeParent String Present only on the _date / _time helper entries of a time property. Skip these

Time entries

Field Type Description
name String Property id
displayName String Display name (optional)

The response carries further fields used by the app; ignore any you do not recognise.

Caching

Responses carry an ETag and Cache-Control: private, max-age=300, must-revalidate. Send the ETag back as If-None-Match to get 304 Not Modified when nothing changed. After you edit a model, the next request returns the new catalogue.

Uses

  • Schema discovery — see what you can query before writing a request.
  • Dynamic interfaces — build pickers that follow the model.
  • Checks after a deployment — confirm the models and properties you expect exist.

The model definition

The definition is a JSON document — the body of POST /model-editor/{model} and the answer of GET /model-editor/{model}.

{
  "id": "ecommerce",
  "name": "E-Commerce",
  "datasets": [
    {
      "id": "orders",
      "name": "Orders",
      "properties": [ ... ],
      "primaryTime": { "property": "orderedAt", "bucketSize": "15 Minutes" }
    },
    {
      "id": "customers",
      "name": "Customers",
      "properties": [ ... ]
    }
  ]
}

Model fields

Field Required Description
id Yes Unique model identifier, used in API paths
name Yes Display name
datasets Yes The dataset definitions
globalDatasets No Global datasets this model shows, fully qualified (["global.countries"]). Optional — a reference to global.X works without it

Dataset fields

Field Required Description
id Yes Unique dataset identifier within the model
name Yes Display name
properties Yes The property definitions
primaryTime No The dataset's main time property: { "property": "<time property id>", "bucketSize": "15 Minutes" }. Both fields are required when you set it. Queries that filter on this property by time range answer fastest
hierarchies No Drill paths: [{ "id": "geography", "name": "Geography", "properties": ["customers.country", "customers.city"] }] — at least two Id, Attribute, Set of Attributes or Reference properties of the model, written dataset.property, coarsest first. See Hierarchies and Drill-down
source No A CSV file the server reads from its own data directory ({ "type": "csv", "file": "orders.csv" }) — for the desktop app. Omit it for data you upload

Property fields

Field Required Description
id Yes Property identifier, used in queries as dataset.property
name Yes Display name
type Yes ID, Attribute, SetOfAttributes, Reference, Measure or Time — see Property Types
source No The file column it is read from: { "column": "customer_id" }. Defaults to the property id
reference For Reference The dataset it points at, in the same model, or a global dataset (global.countries)
granularity For Time How finely times are kept: 1 Minute, 5 Minutes, 15 Minutes (recommended), 1 Hour, 4 Hours or 24 Hours
scale For Measure Decimal places, as a power of 10: 1 (whole numbers, the default), 100 (two decimals) … up to 1000000000000000000 (18 decimals). Any other value is refused when the model is saved
roundingStep For Measure Round values to the nearest step — 1000 rounds to thousands
global No (ID, Attribute, SetOfAttributes) Share one set of values across properties. A global collection (global.country) limits the property to the shared reference values; any other name shares values within your workspace

Where the data comes from

  • Uploaded files (CSV, compressed CSV, Parquet, ZIP) need no source on the dataset — a file is loaded into the dataset it was uploaded for. See the Upload Endpoint.
  • Databases are loaded as snapshots: export a query's result to files and upload them. A model never connects to your database, and a "type": "jdbc" source is refused when the model is loaded. See Loading Best Practices → Databases.

In both cases each property's source.column names a column of the file, not of your database.

Complete example

Two linked datasets:

{
  "id": "travel",
  "name": "Travel",
  "datasets": [
    {
      "id": "customers",
      "name": "Customers",
      "properties": [
        { "id": "customerId", "name": "Customer ID", "type": "ID", "source": { "column": "customer_id" } },
        { "id": "country", "name": "Country", "type": "Attribute" },
        { "id": "segment", "name": "Segment", "type": "Attribute" }
      ]
    },
    {
      "id": "bookings",
      "name": "Bookings",
      "properties": [
        { "id": "bookingId", "name": "Booking ID", "type": "ID", "source": { "column": "booking_id" } },
        { "id": "customerId", "name": "Customer", "type": "Reference", "reference": "customers", "source": { "column": "customer_id" } },
        { "id": "destination", "name": "Destination", "type": "Attribute" },
        { "id": "price", "name": "Price", "type": "Measure", "scale": 100 },
        { "id": "nights", "name": "Nights", "type": "Measure" },
        { "id": "bookedAt", "name": "Booked At", "type": "Time", "source": { "column": "booked_at" }, "granularity": "15 Minutes" }
      ],
      "primaryTime": { "property": "bookedAt", "bucketSize": "15 Minutes" }
    }
  ]
}
  • customers.customerId is the ID — one per customer.
  • bookings.customerId is a Reference to customers, so a query can combine bookings with customer properties.
  • bookings.price has scale: 100 — 299.99 is kept exactly.
  • bookings.bookedAt is the primary time.

Saving a model

POST /model-editor/{model} creates the model or replaces its definition with the body. You can keep changing a model after data is loaded: add properties, rename labels, add and remove datasets. Engeene checks every save against the previous version of the model and refuses a change that would make the loaded data read wrongly. What each change does to the records already loaded, in the app's terms, is in Changing a Model That Holds Data.

How a save is checked

Every save — in the Model Editor or with POST /model-editor/{model} — is checked twice:

  1. Structure — every Reference property must point at a dataset that exists.
  2. Compatibility — the new model is compared with the current one, and breaking changes are refused.

All problems come back in one response, so you can fix them in one pass. Each carries a stable code, the path it is about (dataset.property) and a message:

{
  "errors": [
    {
      "code": "REFERENCE_TARGET_NOT_FOUND",
      "path": "bookings.customerId",
      "message": "REFERENCE property 'customerId' on dataset 'bookings' points at unknown dataset 'customers'. Either add the dataset or remove the reference."
    }
  ]
}

Safe changes

These take effect when you save; the loaded data keeps answering queries.

Change What happens to existing rows
Rename a display name (name) Only labels change
Add a property Until the dataset is reloaded (Re-ingest), a query naming the new property is refused with UNKNOWN_COLUMN — never answered with a made-up value. After the reload, rows that were loaded before have no value for it: Measure Is Null matches them, and Sum, Average, Minimum, Maximum and Count skip them. New loads fill it in
Add a dataset Queries return nothing until the first load
Increase a measure's scale (100 → 10000) Existing values stay exact
Remove a property Queries no longer see it. Its data keeps taking space until the workspace's data is rebuilt — see Reclaiming space
Remove a dataset together with every Reference to it The dataset is removed

Changes that are refused

Code Change Instead
PROPERTY_TYPE_CHANGED A property's type changed (Measure → Attribute, …) Add a property with a new id and the new type, load data into it, then remove the old one
MEASURE_SCALE_SHRUNK A measure's scale got smaller (100 → 10) — existing values would lose decimals Keep the scale, or add a new property
TIME_GRANULARITY_CHANGED A Time property's granularity changed — old and new rows would group differently Keep the granularity, or add a new property
DATASET_REMOVED_WITH_INBOUND_REFERENCE A dataset was removed while another dataset still references it Remove the referencing properties in the same save. The Model Editor offers this when you delete a referenced dataset
REFERENCE_TARGET_NOT_FOUND / REFERENCE_TARGET_MISSING A Reference points at a dataset that does not exist Fix the name, add the dataset, or remove the reference

Removing a referenced dataset in one save:

// Before
"datasets": [
  { "id": "agencies", ... },
  { "id": "bookings", "properties": [
    { "id": "agencyId", "type": "Reference", "reference": "agencies" }
  ]}
]

// After — agencies and bookings.agencyId removed together
"datasets": [
  { "id": "bookings", "properties": [ ... ] }
]

When you need a refused change applied to data that is already loaded, contact support: the workspace's data can be rebuilt from its uploaded files under the new model. Queries keep working while that runs.

Reclaiming space

A removed property or dataset stops appearing in queries straight away, but its stored data is released only when the workspace's data is rebuilt under the current model. Contact support to do this.

Quick reference

You want to… Save Existing data Then
Rename a label Accepted Unchanged —
Add a property Accepted Refused in queries until reloaded, then empty Re-ingest or upload data with the new column
Add a dataset Accepted Empty Upload data
Remove a property Accepted Hidden Optionally reclaim space
Remove a dataset and its references Accepted Removed —
Increase decimal places Accepted Unchanged —
Decrease decimal places Refused — Add a new property
Change a property's type Refused — Add a new property
Change a time granularity Refused — Add a new property
Remove a dataset that is still referenced Refused — Remove the references in the same save
← AuthenticationUpload Endpoint →