Back to Nightingale

Dashboards (boards)

aiagent/skill/embedded/builtin/skill-creator/api/boards.md

9.1.16.1 KB
Original Source

Dashboards (boards)

In n9e a monitoring dashboard is called a board. A board carries its metadata (name, group, tags, note, public flags) in the board table, while its panels/layout/variables are stored as one large JSON blob in a separate board_payload table. Use these endpoints to list dashboards across your business groups, look up specific boards by id, or fetch a single board together with its full panel configuration.

Gateway call: GET. Include the /api/n9e prefix in path. Response {"ok":true,"status":200,"data":{"dat":<payload>,"err":""}} — read data["dat"]. Protocol: see ../n9e-api.md.

Endpoints

PathPurposedat shape
/boardsBoards selected by explicit idsBare array of reduced objects (NOT full Board) — see note below
/busi-groups/boardsBoards across your business groupsBare array of Board (with bgids filled; configs empty)
/busi-group/:id/boardsBoards of one business group (:id in path)Bare array of Board (configs empty)
/board/:bidOne board WITH its panel config (:bid in path)Single Board object (configs populated)

Notes:

  • :bid for /board/:bid may be either the numeric board id or the board's string ident (the handler tries ident first, then id).
  • The list endpoints do NOT include panel data; configs is empty on them. Only /board/:bid fills configs.

Query parameters

ParamTypeRequiredDefaultMeaningEndpoint
bidsstring (csv of int64)noempty (→ empty result)Comma-separated board ids to fetch/boards
gidsstring (csv of int64)noyour groupsComma-separated business-group ids to filter by; if empty, defaults to all groups you belong to/busi-groups/boards
querystringnoemptySpace-separated fuzzy filter over board name + tags. A term prefixed with - excludes matches (e.g. web -test)/busi-groups/boards, /busi-group/:id/boards

/board/:bid takes no query params (all input is in the path).

Response — dat payload

List endpoints return a bare array (Pattern B); /board/:bid returns a single object.

For /busi-groups/boards, /busi-group/:id/boards, and /board/:bid, each element is a Board (models/board.go):

Field (json)TypeMeaning
idint64Board id (primary key)
group_idint64Owning business-group id
namestringDashboard name
identstringOptional unique string identifier (used for shareable/public URLs; may be empty)
tagsstringSpace-separated tags
notestringFree-text description
create_atint64Creation time (Unix seconds)
create_bystringCreator username
update_atint64Last-update time (Unix seconds)
update_bystringLast-updater username
update_by_nicknamestringDisplay nickname of last updater (computed; filled on list endpoints)
configsstring(computed) The board's full panel/layout config as a JSON-encoded string. Empty on list endpoints; populated only by /board/:bid. See below.
publicintWhether the board is public — 0: false, 1: true
public_cateintPublic visibility category — 0: anonymous, 1: any logged-in user, 2: business-group members
bgids[]int64(computed) Extra business-group ids the board is shared to; filled only by /busi-groups/boards
built_inintWhether this is a built-in board — 0: false, 1: true
hideintWhether the board is hidden from the list — 0: false, 1: true

/boards returns a reduced shape (not Board)

The /boards endpoint does NOT return Board objects. Its handler (boardGetsByBids) returns a bare array of small objects, one per found board, with only these keys:

Field (json)TypeMeaning
board_idint64Board id
board_namestringDashboard name
busi_group_idint64Owning business-group id
busi_group_namestringOwning business-group name

(Boards whose business group can't be resolved are silently skipped.) If you need full fields or panels for these ids, call /board/:bid per id.

Getting panel configs

Panels are NOT inline fields of Board. They live in the separate board_payload table (models/board_payload.go, column payload). The configs field is marked gorm:"-", so it is empty in every list response. Only /board/:bid populates it: the boardGet handler calls BoardGet, which loads the board row and then sets board.Configs = BoardPayloadGet(id).

configs is itself a JSON-encoded string (the whole dashboard: panels, layout/grid positions, template variables, etc.), so consumers must parse dat["configs"] a second time to inspect individual panels and their queries. It may be an empty string if the board has no saved payload.

Example

Request:

json
{"method":"GET","path":"/api/n9e/busi-groups/boards","query":{}}

Response (trimmed):

json
{
  "ok": true,
  "status": 200,
  "data": {
    "dat": [
      {
        "id": 12,
        "group_id": 2,
        "name": "Host Overview",
        "ident": "",
        "tags": "host linux",
        "note": "",
        "create_at": 1700000000,
        "create_by": "root",
        "update_at": 1700100000,
        "update_by": "root",
        "update_by_nickname": "Administrator",
        "configs": "",
        "public": 0,
        "public_cate": 0,
        "bgids": [3, 4],
        "built_in": 0,
        "hide": 0
      }
    ],
    "err": ""
  }
}

Fetch one board with its panels:

json
{"method":"GET","path":"/api/n9e/board/12","query":{}}

Response (trimmed) — configs is now a JSON string you must parse again:

json
{
  "ok": true,
  "status": 200,
  "data": {
    "dat": {
      "id": 12,
      "name": "Host Overview",
      "group_id": 2,
      "configs": "{\"version\":\"3.0.0\",\"panels\":[{\"type\":\"timeseries\",\"targets\":[{\"expr\":\"cpu_usage_active\"}]}]}",
      "public": 0,
      "public_cate": 0,
      "built_in": 0,
      "hide": 0
    },
    "err": ""
  }
}