Back to Nightingale

Teams (user groups)

aiagent/skill/embedded/builtin/skill-creator/api/user-groups.md

9.1.13.0 KB
Original Source

Teams (user groups)

Teams are named groups of users. They are the unit that notification routing targets and that busi-group membership grants access through — a rule, subscription, or mute can notify "team X", and a business group lists the teams allowed to see it. Use these endpoints to list the teams the caller can see and to read one team together with its member users.

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
/user-groupsTeams the caller can see (filtered by query)Pattern B — bare array of UserGroup
/user-group/:idOne team with its member users (:id in path)Single UserGroup object

Query parameters (/user-groups)

ParamTypeRequiredDefaultMeaning
querystringno""Case-insensitive text filter over team name / note; empty returns all visible teams
limitintno1500Max number of teams returned

Response — dat payload

(/user-groups = Pattern B bare array; /user-group/:id = single object, includes members.) Each team is a UserGroup:

Field (json)TypeMeaning
idint64Team ID
namestringTeam name
notestringDescription / note
create_atint64Creation time (unix seconds)
create_bystringUsername of creator
update_atint64Last update time (unix seconds)
update_bystringUsername of last updater
update_by_nicknamestringNickname of last updater (computed)
usersarrayMember users of the team (computed). Populated on /user-group/:id; may be empty/omitted in the list response. Each element has id (int64), username (string, login), nickname (string, display name), plus other user fields.
busi_groupsarrayBusiness groups this team belongs to (computed); each element carries id and name. Typically empty unless explicitly loaded.

Example

Request:

json
{"method":"GET","path":"/api/n9e/user-groups","query":{"limit":"1500"}}

Response (trimmed):

json
{
  "ok": true,
  "status": 200,
  "data": {
    "dat": [
      {
        "id": 1,
        "name": "ops-oncall",
        "note": "primary on-call rotation",
        "create_at": 1710000000,
        "create_by": "root",
        "update_at": 1710500000,
        "update_by": "root",
        "update_by_nickname": "Administrator",
        "users": [],
        "busi_groups": []
      }
    ],
    "err": ""
  }
}

Reading one team with members — request {"method":"GET","path":"/api/n9e/user-group/1"} — returns a single object where users is filled:

json
{
  "id": 1,
  "name": "ops-oncall",
  "users": [
    {"id": 1, "username": "root", "nickname": "Administrator"},
    {"id": 5, "username": "alice", "nickname": "Alice"}
  ],
  "busi_groups": []
}