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.

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

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

Variables:

{
  "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

{
  "data": {
    "createDashboard": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "DA-EXMP-0000-000F",
      "type": "Dashboard",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000"
    }
  },
  "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

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

Variables:

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

Example response

{
  "data": {
    "dashboardMetrics": {
      "dashboardId": "01900000-0000-7000-8000-71d51a360000"
    }
  },
  "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

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
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "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

{
  "data": {
    "updateDashboard": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "DA-EXMP-0000-000F",
      "type": "Dashboard",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}