Jump to content

OperatorAPI lookup

From Wiki 7Kas

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

Description

One writable field's picker, served for a GIVEN root instead of baked into the func=options contract for your own. It exists so a client list can FOLLOW a selected root: ssipdevices lets a super reassign a device to any root, and the Cliente dropdown must become that root's clients or a save silently reassigns. The super may ask for ANY root (reasign.all); an operator may ask only for its own and a different root is refused, never quietly answered for the wrong tenant. The picker is shaped by the SAME engine func=options uses, so it cannot drift; only the tenant it is pinned to differs. The section's own read gate applies first.

A generic verb: it works over any section via the section parameter. Discover sections with OperatorAPI sections and a section's fields/capabilities with OperatorAPI options.

Call

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

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

Parameters

Parameter Type Required Default Meaning
section string Yes The section key, e.g. ssipdevices.
field string Yes The writable field whose picker you want, e.g. accountcode_id.
root integer No The root whose list you want. (REQUIRED for a super (any root). For an operator it may be omitted (means your own) and any other root is refused)

Example

https://host:port/newadm?func=lookup&section=ssipdevices&field=accountcode_id&root=5

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":{
    "section":s,
    "field":s,
    "root":n,
    "options":[
      {
        "value":s,
        "label":s
      }
    ],
    "options_error":s|null
  }
}

Errors

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


Back to OperatorAPI