Jump to content

OperatorAPI session:menu: Difference between revisions

From Wiki 7Kas
Operator API reference (generated from func=help)
 
Operator API reference: multi-line response shape
 
Line 15: Line 15:


== Response ==
== Response ==
Success is <code>{"ok":true,"data":{...}}</code>; on refusal <code>{"ok":false,"code":"...","message":"..."}</code>. This function's data shape: <code>{"ok":true,"data":{"operator":{"accountcode":s,"name":s,"groups":[s],"readonly":b},"menu":[{"id":n,"title":s,"icon":s,"detail":s,"children":[...]}|{"id":n,"title":s,"icon":s,"detail":s,"section":s,"served":b,"func":s|null,"write":{"add":b,"edit":b,"delete":b}}],"progress":{"sections":n,"served":n}}}</code>.
Success is <code>{"ok":true,"data":{...}}</code>; on refusal <code>{"ok":false,"code":"...","message":"..."}</code>. This function's data shape (<code>n</code> = number, <code>s</code> = string, <code>?</code> = present only when set):
<pre>
{
  "ok":true,
  "data":{
    "operator":{
      "accountcode":s,
      "name":s,
      "groups":[
        s
      ],
      "readonly":b
    },
    "menu":[
      {
        "id":n,
        "title":s,
        "icon":s,
        "detail":s,
        "children":[
          ...
        ]
      }|{
        "id":n,
        "title":s,
        "icon":s,
        "detail":s,
        "section":s,
        "served":b,
        "func":s|null,
        "write":{
          "add":b,
          "edit":b,
          "delete":b
        }
      }
    ],
    "progress":{
      "sections":n,
      "served":n
    }
  }
}
</pre>


== Errors ==
== Errors ==

Latest revision as of 08:28, 19 August 2026

newadmapi (Operator API) function. Available to: Operator, SuperRoot.

Description

The menu this operator may see, NESTED as the legacy renders it: the rows of web_menus for their root, filtered by their groups, built into containers and leaves. A leaf carries served=true and the func to call when this API serves that section, and served=false with func=null when it does not - drawn but not navigable, so the panel shows the whole old menu without offering a route that would refuse. Presentation only: every route authorizes independently, so a section absent here is refused by the route as well, not merely unlisted.

Call

GET|POST https://YOUR_HOST:9089/newadm?func=session:menu

Send your API key with every request (header X-API-Key: YOUR_KEY, or Authorization: Bearer YOUR_KEY, or the ukey query parameter).

Parameters

None beyond the API key and func=session:menu.

Example

https://host:port/newadm?func=session:menu

Response

Success is {"ok":true,"data":{...}}; on refusal {"ok":false,"code":"...","message":"..."}. This function's data shape (n = number, s = string, ? = present only when set):

{
  "ok":true,
  "data":{
    "operator":{
      "accountcode":s,
      "name":s,
      "groups":[
        s
      ],
      "readonly":b
    },
    "menu":[
      {
        "id":n,
        "title":s,
        "icon":s,
        "detail":s,
        "children":[
          ...
        ]
      }|{
        "id":n,
        "title":s,
        "icon":s,
        "detail":s,
        "section":s,
        "served":b,
        "func":s|null,
        "write":{
          "add":b,
          "edit":b,
          "delete":b
        }
      }
    ],
    "progress":{
      "sections":n,
      "served":n
    }
  }
}

Errors

Refusals carry a machine-readable code (branch on the code, never the message). See OperatorAPI#Error codes.


Back to OperatorAPI