AlmondTill/G3N API

Build a dashboard

Lay out the canned metric widgets you want at a glance, read the live figures, and rename or re-lay it as your questions change.

Insights · a play in 3 steps.

In the office

Open the office and read the morning picture: sales today and this week, how people paid, what is running low. The office home shows the standing figures; a dashboard of your own lays out exactly the tiles you want to see first — a shop with two registers and an online lane will want different tiles from a single counter.

Where it starts: the office’s Dashboards page.

Dashboards — /dashboards
Dashboards — /dashboards

Step 1. Lay out the widgets.

Step 2. Read the live figures — each tile answers honestly or not at all.

Step 3. Rename it or replace the layout.

What you see

Last month the example shop rang 834 sales for CAD 281315.16 net. People paid like this: cash CAD 58484.45 · card CAD 221515.70 · gift card CAD 826.28. On the Dashboards page the example shop has no dashboards yet; each tile of a dashboard answers from the live records or says honestly that it cannot.

Try it

Walked with screenshots in the owner’s manual: chapter 1 — Read your numbers each morning — and build a dashboard of your own

For developers — the calls

The steps

  1. Lay out the widgets. — createDashboard
  2. Read the live figures — each tile answers honestly or not at all. — dashboardMetrics
  3. Rename it or replace the layout. — updateDashboard

The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

createDashboard

createDashboard — mutation · Create a dashboard — an ordered layout of canned metric widgets.

Example request

graphql
mutation ExampleCreateDashboard($input: NewDashboardInput!) {
  createDashboard(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    landing
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "widgets": [
      {
        "metricKey": "sales_today",
        "ordinal": 1
      }
    ]
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "createDashboard": {
      "id": "01900000-0000-7000-8000-11f6d87b0000",
      "sysId": "DA-EXMP-0000-000F",
      "type": "Dashboard",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "landing": true
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

dashboardMetrics

dashboardMetrics — query · One dashboard’s widgets answered with live figures — counts and per-currency totals computed at read time, each stamped with when it was read.

Example request

graphql
query ExampleDashboardMetrics($id: ID) {
  dashboardMetrics(id: $id) {
    dashboardId
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-37386ae00000"
}

Example response

json
{
  "data": {
    "dashboardMetrics": {
      "dashboardId": "01900000-0000-7000-8000-11f6d87b0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

updateDashboard

updateDashboard — mutation · Rename a dashboard or replace its widget layout wholesale.

Example request

graphql
mutation ExampleUpdateDashboard($id: ID!, $revision: ID!, $input: EditDashboardInput!) {
  updateDashboard(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    landing
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-11f6d87b0000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "input": {
    "caption": "Blue jeans"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "updateDashboard": {
      "id": "01900000-0000-7000-8000-11f6d87b0000",
      "sysId": "DA-EXMP-0000-000F",
      "type": "Dashboard",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "landing": true
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}