Jump to content

OperatorAPI login

From Wiki 7Kas

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

Description

Exchanges an operator ukey for a short, revocable session. The key goes in the X-API-Key HEADER and is never accepted in the query string or body. Every failure returns the same auth_invalid, so a blocked key cannot be told apart from an unknown one.

Call

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

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=login.

Example

https://host:port/newadm?func=login

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":{
    "session":s,
    "operator":{
      "accountcode":s,
      "name":s,
      "groups":[
        s
      ],
      "readonly":b
    }
  }
}

Errors

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


Back to OperatorAPI