コンテンツにスキップ
ユーザーインターフェースAPI

ユーザーインターフェースAPI

ユーザーインターフェースAPIは、JWT認証でクライアントのリクエストを検証します。

ユーザー認証

ログイン

POST /web/api/login

{
    "loginName": "sys",
    "password": "manager"
}

トークンの更新

POST /web/api/relogin

{
    "refreshToken": "refresh token that was issued with 'login'"
}

ログアウト

POST /web/api/logout

  • LogoutReq:
{
    "refreshToken": "refresh token that was issued with 'login'"
}

状態の確認

GET /web/api/check

現在のトークンの状態を検証します。

  • LoginCheckRsp
{
    "success": true,
    "reason": "string",
    "elapse": "string",
    "experimentMode": false,
    "server": {"version":"v1.2.3"},
    "shells": [{"ShellDefinition"}]
}
  • ShellDefinition
{
    "id": "shell definition id (uuid)",
    "type": "type",
    "icon": "icon name",
    "label": "display name",
    "theme": "theme name",
    "command": "terminal shell command",
    "attributes": [
        { "removable": true },
        { "cloneable": true },
        { "editable": true }
    ]
}
  • 種類
型説明
sqlSQLエディター
tqlTQLエディター
wrkワークスペースエディター
tazタグアナライザー
termターミナル

データベース

SQLの実行

GET, POST /web/machbase

/db/query APIと同じように動作し、認証方式だけが異なります。 /db/queryはクライアントアプリケーションをAPIトークンで認証し、 /web/machbaseはユーザー操作用にJWTを検証します。

テーブル一覧の取得

GET /web/api/tables?showall=false&name=pattern

テーブル一覧を返します。

  • showallをtrueにすると、非表示のテーブルもすべて含めます。
  • nameはテーブル名の絞り込みパターンです。?や*を含むglob式、または?と*を含まない接頭辞を指定できます。
{
    "success": true,
    "reason": "success or other message",
    "elapse": "elapse time in string format",
    "data": {
        "columns": ["ROWNUM", "DB", "USER", "NAME", "TYPE"],
        "types": ["int32", "string", "string", "string", "string"],
        "rows":[
            [1, "MACHBASE", "SYS", "TABLENAME", "TAG TABLE"],
        ]
    }
}

タグ一覧の取得

GET /web/api/tables/:table/tags?name=prefix

指定テーブルのタグ一覧を返します。

  • nameを指定すると、その接頭辞で始まるタグだけを返します。
{
    "success": true,
    "reason": "success or other message",
    "elapse": "elapse time in string format",
    "data": {
        "columns": ["ROWNUM", "NAME"],
        "types": ["int32", "string"],
        "rows":[
            [1, "temperature"],
        ]
    }
}

タグ統計

GET /web/api/tables/:table/tags/:tag/stat

指定テーブルのタグ統計を返します。

{
    "success": true,
    "reason": "success or other message",
    "elapse": "elapse time in string format",
    "data": {
        "columns": ["ROWNUM", "NAME", "ROW_COUNT", "MIN_TIME", "MAX_TIME",
            "MIN_VALUE", "MIN_VALUE_TIME", "MAX_VALUE", "MAX_VALUE_TIME", "RECENT_ROW_TIME"],
        "types": ["int32", "string", "int64", "datetime", "datetime",
            "double", "datetime", "double", "datetime", "datetime"],
        "rows":[
            ["...omit...."],
        ]
    }
}

シェルとターミナル

シェル定義の取得・追加・複製・変更・削除には、JSON-RPCのshell.*メソッドを使用します。

データチャネル

ws://{server_address}/web/api/term/:term_id/data

ターミナル用のWebSocketです。

ウィンドウサイズ

POST /web/api/term/:term_id/windowsize

ターミナルのサイズを変更します。

TerminalSize

{ "rows": 24, "cols": 80 }

サーバーイベント

イベントチャネル

ws://127.0.0.1:5654/web/api/console/{console_id}/data?token={jwt_token}

双方向メッセージ用のWebSocketです。

  • メッセージの種類
{
    "type": "type(see below)",
    "ping": {
        "tick": 1234
    },
    "log": {
        "level": "INFO",
        "message": "log message"
    }
}
型フィールド説明
pingpingメッセージ
ping.tick任意の整数。サーバーは、クライアントが送信した数値をそのまま返します。
loglog.levelログレベル:TRACE、DEBUG、INFO、WARN、ERROR
log.messageログメッセージ
log.repeat同じメッセージが連続して2回以上繰り返された場合の回数

TQLとワークスペース

TQLのコンテンツタイプ

ヘッダー
Content-Type
ヘッダー
X-Chart-Type
内容
text/html“echart”, “geomap”完全なHTML。
例:<iframe>内に埋め込む
text/html-完全なHTML。
例:<iframe>内に埋め込む
text/csv-CSV
text/markdown-Markdown
application/json“echart”, “geomap”JSON(echartまたはgeomapのデータ)
application/json-JSON
application/xhtml+xml-HTML要素。例:<div>...</div>

TQLファイルの実行

GET /web/api/tql/*path

指定パスのTQLを実行します。応答形式は、前述の「TQLのコンテンツタイプ」表を参照してください。

POST /web/api/tql/*path

指定パスのTQLを実行します。応答形式は、前述の「TQLのコンテンツタイプ」表を参照してください。

TQLスクリプトの実行

POST /web/api/tql

ボディにTQLスクリプトを送信すると、サーバーが実行結果を返します。 応答形式は、「TQLのコンテンツタイプ」表を参照してください。

リクエストに$クエリパラメーターがある場合は、その値をTQLスクリプトとして扱い、 ボディをデータとして処理します。$パラメーターは、v8.0.17以降で使用できます。

Markdownのレンダリング

Markdownのレンダリングには、JSON-RPCのmarkdown.renderメソッドを使用します。

ファイル管理

Content-Type

ファイルの種類とContent-Typeの対応です。

ファイルの種類Content-Type
.sqltext/plain
.tqltext/plain
.tazapplication/json
.wrkapplication/json
unknownapplication/octet-stream

ファイルの読み取り

GET /web/api/files/*path

パスがファイルを指す場合は、その内容を返します。

パスがディレクトリを指す場合は、エントリの一覧を返します。

  • Entry
{
    "isDir": true,
    "name": "name",
    "content": "bytes array, if the entry is a file",
    "children": [{"SubEntry, if the entry is a directory"}],
}
  • SubEntry
{
    "isDir": true,
    "name": "name",
    "type": "type",
    "size": 1234,
    "lastModifiedUnixMillis": 169384757
}

ファイルの書き込み

POST /web/api/files/*path

  • pathがファイルを指す場合は、ボディの内容をそのファイルに書き込みます。

  • pathがディレクトリでボディが空の場合は、空のディレクトリを作成し、そのEntryを返します。

  • pathがディレクトリでボディがGitCloneReq JSONの場合は、リモートGitリポジトリをそのパスにクローンし、ディレクトリのEntryを返します。

GitCloneReq

{
    "command": "clone",
    "url": "https://github.com/machbase/neo-samples.git"
}
  • command : clone, pull

ファイルの名前変更・移動

PUT /web/api/files/*path

ファイルまたはディレクトリの名前を変更するか、移動します。

RenameReq

{
    "destination": "target path",
}

操作が正常に完了すると、APIは200 OKを返します。

ファイルの削除

DELETE /web/api/files/*path

pathのファイルを削除します。パスが空でないディレクトリを指す場合は、エラーを返します。

キー管理

キーはJSON-RPCのkey.*メソッドで、APIトークンはtoken.*メソッドで管理します。

SSHキー

SSHキーは、JSON-RPCのsshkey.*メソッドで管理します。

タイマー

タイマーは、JSON-RPCのtimer.*メソッドで管理します。

ブリッジ

ブリッジの管理とコマンドの実行には、JSON-RPCのbridge.*メソッドを使用します。

サブスクライバー

サブスクライバーは、JSON-RPCのsubscriber.*メソッドで管理します。

バックアップ

バックアップの取得

GET /web/api/backup/archives

バックアップ一覧を返します。

  • 既定のバックアップディレクトリは、machbase-neo実行ファイルのディレクトリ配下のbackupsです。
  • 保存先を変更するには、--backup-dir={path}オプションを指定してmachbase-neoを起動します。既定値を使う場合、このオプションは不要です。

レスポンス

{
    "data": [
        {
            "path": "example_backup1",
            "isMount": true,
            "mountName": "backup1"
        },
        {
            "path": "example_backup2",
            "isMount": false
        }
    ],
    "elapse": "6.562299ms",
    "reason": "success",
    "success": true
}

DBのバックアップ

POST /web/api/backup/archive

データベースをバックアップします。

  • 完全バックアップ:全データをバックアップします。
  • 増分バックアップ:完全バックアップまたは前回の増分バックアップ以降に追加されたデータだけをバックアップします。
  • 期間バックアップ:指定期間のデータをバックアップします。

リクエスト

{
    "type":"database", // database or table
    "tableName":"",
    "duration":{
        "type":"full",
        "after":"",
        "from":"",
        "to":""
    },
    "path":"example_backup1"
    // "path":"/home/neo/backups/example_backup1" // Absolute Path
}

レスポンス

{
    "success": true,
    "reason": "success",
    "elapse": "231.3µs"
}

バックアップ状態

GET /web/api/backup/archive/status

バックアップ状態を返します。

レスポンス

{
    "data": {
        "type": "database",
        "tableName": "",
        "duration": {
            "type": "full",
            "after": "",
            "from": "",
            "to": ""
        },
        "path": "/home/neo/neo-server/tmp/machbase_home/dbs/example_backup1",
    },
    "elapse": "1.1µs",
    "reason": "success",
    "success": true
}

マウント

マウント一覧

GET /web/api/backup/mounts

マウント一覧を返します。

レスポンス

{
    "data": [
        {
            "name": "machbase_backup_19700101090000_20240726104832_15",
            "path": "backup1",
            "tbsid": 23,
            "scn": 15,
            "mountdb": "MOUNT_BACKUP1",
            "dbBeginTime": "1970-01-01 09:00:00",
            "dbEndTime": "2024-07-26 10:48:32",
            "backupBeginTime": "2024-07-26 10:48:32",
            "backupEndTime": "2024-07-26 10:48:34",
            "flag": 0
        }
    ],
    "elapse": "424.3µs",
    "reason": "success",
    "success": true
}

DBのマウント

POST /web/api/backup/mounts/:name

データベースをマウントします。

  • :name: マウント名
  • path: バックアップデータベースのパス(絶対パスと相対パスの両方を使用可能)
{
    "path":"example_backup1" // Relative Path
    // "path":"/home/machbase/machbase_home/dbs/example_backup1" // Absolute Path
}

DBのアンマウント

DELETE /web/api/backup/mounts/:name

データベースをアンマウントします。

  • :name: アンマウントする名前

レスポンス

{
    "elapse": "46.8694ms",
    "reason": "success",
    "success": true
}

パッケージ

パッケージのインストールと削除は、JSHのpkgコマンドで行います。

その他

参考資料

GET /web/api/refs/*path

  • ReferenceGroup
{
    "label": "group name",
    "items":[{"ReferenceItem"}]
}
  • ReferenceItem
{
    "type": "type",
    "title": "display title",
    "address": "url address",
    "target": "browser link target"
}
  • type: url, wrk, tql, sql
  • address:serverfile://<path>接頭辞がある場合はサーバー側のファイルを指し、 それ以外の場合はhttps://で始まる外部WebのURLです。

SQL文の分割

SQL文の分割には、JSON-RPCのsql.splitメソッドを使用します。

ライセンス情報

GET /web/api/license

{
    "success": true,
    "reason": "success or error reason",
    "elapse": "elapse time",
    "data": {
        "id": "license id",
        "type": "type",
        "customer": "customer",
        "project": "project",
        "countryCode": "country code",
        "installDate": "installation date",
        "issueDate": "license issue date"
    }
}

ライセンスのインストール

POST /web/api/license

ライセンスファイルをインストールします。

WebSocket

ws://127.0.0.1:5654/web/api/console/{console_id}/data?token={jwt_token}

console_idには、セッションを正しく管理するため、クライアントアプリケーションが生成した一意の識別子を指定します。

このエンドポイントでは、HTTPのAuthorizationヘッダーではなく、クエリパラメーター(token={jwt_token})でJWTトークンを渡します。

このエンドポイントでは、サーバーとクライアントがJSONオブジェクトを交換し、構造化された安全な形式で通信します。

PING

クライアントは、現在時刻をUNIXエポック形式で含むPINGメッセージを送信できます。 サーバーは同じペイロードを返すため、往復遅延時間を正確に測定できます。 この仕組みは、接続を維持し、アイドルタイムアウトを防ぐためにも役立ちます。

  • 方向: C -> S
{
    "type": "ping",
    "ping": {
        "tick": 1759127437000
    }
}

LOG

サーバーは、ユーザー向けのメッセージで状態更新やエラーを通知します。 状態、問題、対処方法を明確に伝え、操作や問題解決を支援します。

  • 方向: S -> C
{
    "type": "log",
    "log": {
        "timestamp": 1759127437000000000,
        "level": "INFO",
        "task": "task-name",
        "message": "Fail to convert from string to number",
        "repeat": 10
    }
}
  • timestamp: ログの発生時刻。ナノ秒単位のUNIXエポック時刻です。
  • level: ログの重要度。"TRACE"、"DEBUG"、"INFO"、"WARN"、"ERROR"のいずれかです。
  • task (省略可能): 関連する処理の名前。
  • message: 説明メッセージ。
  • repeat (省略可能): 同じログメッセージが連続して繰り返された回数。重複出力を減らすために使用します。

JSON-RPC

この節では、JSON-RPC仕様に従うWebSocketベースのリモートプロシージャ呼び出し(RPC)を説明します。 RPCでは、クライアントがサーバー側メソッドを呼び出して構造化された応答を受信でき、 クライアントアプリケーションとサーバーの通信・連携を容易にします。

Web UIは、管理機能用のJSON-RPCエンドポイントを提供します。

  • HTTP POSTエンドポイント: /web/api/rpc
  • WebSocketエンドポイント: /web/api/console/:console_id/data?token={jwt_token}

単純なリクエスト・レスポンス形式の呼び出しには、/web/api/rpcを推奨します。 コンソールセッションとともに双方向メッセージを処理する場合は、/web/api/console/:console_id/data?token={jwt_token}を使用できます。

HTTP JSON-RPCのリクエスト形式

POST /web/api/rpc

リクエストの例:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "shell.list",
    "params": []
}

成功レスポンスの例:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": []
}

エラーレスポンスの例:

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32000,
        "message": "error message"
    }
}

注意:

  • 応答のHTTPステータスは、通常は200 OKです。
  • 成功したかどうかは、HTTPステータスではなくerrorフィールドの有無で判断してください。

WebSocket JSON-RPCのリクエスト形式

ws://{server_address}/web/api/console/:console_id/data?token={jwt_token}

WebSocketでは、rpc_reqとrpc_rspイベントを使用します。 sessionフィールドは、UIクライアントが応答を関連付けるタブやビューを識別するための値です。

リクエスト

  • 方向: C -> S
{
    "type": "rpc_req",
    "session": "{\"view\":\"shell-tab-2\",\"requestId\":\"req-001\"}",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 1234,
        "method": "add",
        "params": [1, 2]
    }
}

レスポンス

  • 方向: S -> C

成功

{
    "type": "rpc_rsp",
    "session": "{\"view\":\"shell-tab-2\",\"requestId\":\"req-001\"}",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 1234,
        "result": 3
    }
}

エラー

{
    "type": "rpc_rsp",
    "session": "{\"view\":\"shell-tab-2\",\"requestId\":\"req-001\"}",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 1234,
        "error": {
            "code": -32000,
            "message": "some error message"
        }
    }
}

Markdown

markdown.render

markdown.render(markdown, darkMode, referer)

パラメーター

  • markdown string
  • darkMode bool
  • referer string - 参照元URL

戻り値

  • string|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "markdown.render",
        "params": [
            "string",
            false,
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": "string"
    }
}

Vizspec

vizspec.render

vizspec.render(vizspec)

パラメーター

  • vizspec object

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "vizspec.render",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

vizspec.export

vizspec.export(vizspec, format)

パラメーター

  • vizspec object
  • format string

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "vizspec.export",
        "params": [
            {},
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

サーバー

server.info.get

server.info.get()

パラメーター

  • なし

戻り値

  • object<ServerInfoResponse>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "server.info.get",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

server.info.statz

server.info.statz(names)

パラメーター

  • names array - メトリクス名

戻り値

  • object<ServerStatzResponse>|error - 名前ごとにグループ化した可視化仕様
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "server.info.statz",
        "params": [
            []
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

server.info.query

server.info.query(maxRows, pattern)

パラメーター

  • maxRows int - 最大行数
  • pattern array - メトリクスキーのワイルドカードフィルター

戻り値

  • object<StatzQueryResult>|error - 表形式のメトリクスクエリ結果
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "server.info.query",
        "params": [
            0,
            []
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

server.info.keys

server.info.keys(pattern)

パラメーター

  • pattern array - メトリクスキーのワイルドカードフィルター

戻り値

  • array<string>|error - ソート済みのメトリクスキー名
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "server.info.keys",
        "params": [
            []
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

server.certificate.get

server.certificate.get()

パラメーター

  • なし

戻り値

  • string|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "server.certificate.get",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": "string"
    }
}

server.shutdown

管理(mgmt)サーバーが実装します。

server.shutdown()

パラメーター

  • なし

戻り値

  • object<ShutdownResponse>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "server.shutdown",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

サービス

service.port.list

service.port.list(svc)

パラメーター

  • svc string

戻り値

  • array<object<model.ServicePort>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "service.port.list",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

プロキシ

proxy.register

proxy.register(req)

パラメーター

  • req object

戻り値

  • object<ProxyEntrySnapshot>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "proxy.register",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

proxy.unregister

proxy.unregister(req)

パラメーター

  • req object

戻り値

  • array<object<ProxyEntrySnapshot>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "proxy.unregister",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

proxy.list

proxy.list(service)

パラメーター

  • service string

戻り値

  • array<object<ProxyEntrySnapshot>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "proxy.list",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

proxy.get

proxy.get(req)

パラメーター

  • req object

戻り値

  • object<ProxyEntrySnapshot>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "proxy.get",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

シェル

shell.list

shell.list()

パラメーター

  • なし

戻り値

  • array<object<model.ShellDefinition>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "shell.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

shell.add

shell.add(name, command)

パラメーター

  • name string
  • command string

戻り値

  • string|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "shell.add",
        "params": [
            "string",
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": "string"
    }
}

shell.copy

指定したシェル定義を複製し、新しいIDが割り当てられたシェル定義を返します。

shell.copy(srcId)

パラメーター

  • srcId string - 複製するシェル定義のID

戻り値

  • object<model.ShellDefinition>|error - 複製されたシェル定義
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "shell.copy",
        "params": [
            "23"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {
            "id": "24",
            "type": "term",
            "icon": "console-network-outline",
            "label": "CUSTOM SHELL",
            "command": "/bin/sh",
            "attributes": [
                {
                    "removable": true
                },
                {
                    "cloneable": true
                },
                {
                    "editable": true
                }
            ]
        }
    }
}

shell.update

シェル定義を変更します。対象はidで指定し、シェル定義全体を渡します。

shell.update(shell)

パラメーター

  • shell object<model.ShellDefinition> - id、type、label、command、icon、theme、attributesを含むシェル定義 commandが空の場合はエラーを返します

戻り値

  • object<model.ShellDefinition>|error - 変更後のシェル定義
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "shell.update",
        "params": [
            {
                "id": "24",
                "type": "term",
                "icon": "console-network-outline",
                "label": "_docgen_uiapi_s2",
                "command": "/bin/bash",
                "attributes": [
                    {
                        "removable": true
                    },
                    {
                        "cloneable": true
                    },
                    {
                        "editable": true
                    }
                ],
                "theme": "dark"
            }
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {
            "id": "24",
            "type": "term",
            "icon": "console-network-outline",
            "label": "_docgen_uiapi_s2",
            "theme": "dark",
            "command": "/bin/bash",
            "attributes": [
                {
                    "removable": true
                },
                {
                    "cloneable": true
                },
                {
                    "editable": true
                }
            ]
        }
    }
}

shell.delete

shell.delete(id)

パラメーター

  • id string

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "shell.delete",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

ブリッジ

bridge.list

bridge.list()

パラメーター

  • なし

戻り値

  • array<object<bridge.BridgeInfo>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

bridge.get

bridge.get(name)

パラメーター

  • name string

戻り値

  • object<bridge.BridgeInfo>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.get",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

bridge.add

bridge.add(name, typ, conn)

パラメーター

  • name string
  • typ string
  • conn string

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.add",
        "params": [
            "string",
            "string",
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

bridge.delete

bridge.delete(name)

パラメーター

  • name string

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.delete",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

bridge.test

bridge.test(name)

パラメーター

  • name string

戻り値

  • bool|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.test",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": false
    }
}

bridge.stats

bridge.stats(name)

パラメーター

  • name string

戻り値

  • object<BridgeStats>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.stats",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

bridge.exec

bridge.exec(name, command)

パラメーター

  • name string
  • command string

戻り値

  • object<BridgeExecResult>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.exec",
        "params": [
            "string",
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

bridge.query

bridge.query(name, query)

パラメーター

  • name string
  • query string

戻り値

  • object<BridgeQueryResult>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.query",
        "params": [
            "string",
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

bridge.result.fetch

bridge.result.fetch(handle)

パラメーター

  • handle string

戻り値

  • object<BridgeQueryRow>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.result.fetch",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

bridge.result.close

bridge.result.close(handle)

パラメーター

  • handle string

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "bridge.result.close",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

SSHキー

sshkey.list

sshkey.list()

パラメーター

  • なし

戻り値

  • array<object<AuthorizedSshKey>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "sshkey.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

sshkey.add

sshkey.add(keyType, key, comment)

パラメーター

  • keyType string
  • key string
  • comment string

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "sshkey.add",
        "params": [
            "string",
            "string",
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

sshkey.delete

sshkey.delete(key)

パラメーター

  • key string

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "sshkey.delete",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

キー

key.list

key.list()

パラメーター

  • なし

戻り値

  • array<object<KeyInfo>>|error - サーバーのキーストアに保存されたキーの一覧
    • idx:一覧内の順番
    • id:キーID。key.deleteに指定します
    • name:キー名
    • notBefore、notAfter:有効期間の開始時刻と終了時刻(Unixタイムスタンプ、秒)
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "key.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": [
            {
                "idx": 0,
                "id": 8,
                "name": "_docgen_uiapi_key",
                "notBefore": 1789632914,
                "notAfter": 2104992914
            }
        ]
    }
}

key.generate

key.generate(name, typ, notBefore, notAfter, store)

パラメーター

  • name string - キー名。小文字に変換して保存されます
  • typ string - 生成するキーの種類。RSAまたはECDSAを指定する必要があります
  • notBefore int64 - キーの有効期間の開始時刻(Unixタイムスタンプ、秒) 省略または0の場合は、現在時刻を使用します
  • notAfter int64 - キーの有効期間の終了時刻(Unixタイムスタンプ、秒) 省略または0の場合は、既定の10年間を使用します
  • store bool - キーペアをサーバーのキーストアに保存するかどうか falseの場合は保存しないため、key.listにも表示されません

戻り値

  • any|error - 生成したキー情報
    • id:キーID。storeがfalseの場合は0です
    • name:キー名
    • certificate:キーペアの証明書
    • key:キーペアの秘密鍵
    • serverKey:サーバー証明書(storeがtrueの場合)
    • zip:キーペアとサーバー証明書を含むZIPアーカイブをbase64でエンコードした文字列(storeがtrueの場合)
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "key.generate",
        "params": [
            "_docgen_uiapi_key",
            "ecdsa",
            0,
            0,
            true
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {
            "certificate": "-----BEGIN CERTIFICATE-----\nXXXXXXXXXXXXXXXXXX\n-----END CERTIFICATE-----\n",
            "id": 8,
            "key": "-----BEGIN EC PRIVATE KEY-----\nXXXXXXXXXXXXXXXX\n-----END EC PRIVATE KEY-----\n",
            "name": "_docgen_uiapi_key",
            "serverKey": "-----BEGIN CERTIFICATE-----\nXXXXXXXXXXXXXXXXXX\n-----END CERTIFICATE-----\n",
            "zip": "UEsDBXXXXXXXXXXXXXXXX"
        }
    }
}

key.delete

key.delete(id)

パラメーター

  • id int64 - key.listまたはkey.generateが返したキーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "key.delete",
        "params": [
            8
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

トークン

発行したトークンの使い方は、APIセキュリティを参照してください。

token.list

token.list()

パラメーター

  • なし

戻り値

  • array<object<ApiTokenInfo>>|error - 呼び出したユーザーのAPIトークン一覧
    • id:トークンID。token.deleteに指定します
    • name:トークン名
    • user:トークンを所有するユーザー
    • hint:一部を伏せたトークン値
    • createdAt:発行時刻(Unixタイムスタンプ、秒)
    • notAfter:有効期限(Unixタイムスタンプ、秒)
    • lastUsedAt:最後に使用した時刻(Unixタイムスタンプ、秒)。一度も使用していない場合は省略されます
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "token.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": [
            {
                "id": 11,
                "name": "_docgen_uiapi_token",
                "user": "SYS",
                "hint": "nt_b_XXXX****XXXX",
                "createdAt": 1789632914,
                "notAfter": 2105252114
            }
        ]
    }
}

token.generate

token.generate(name, notAfter)

パラメーター

  • name string - トークン名。空の場合はエラーを返します
  • notAfter int64 - 有効期限(Unixタイムスタンプ、秒) 0の場合は、発行から10年後に設定します

戻り値

  • object<GeneratedApiToken>|error - token.listの項目と同じフィールドに、トークンの原文であるtokenが加わります トークンの原文は、このレスポンスでしか受け取れません
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "token.generate",
        "params": [
            "_docgen_uiapi_token",
            0
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {
            "id": 11,
            "name": "_docgen_uiapi_token",
            "user": "SYS",
            "hint": "nt_b_XXXX****XXXX",
            "createdAt": 1789632914,
            "notAfter": 2105252114,
            "token": "nt_b_XXXXXXXXXXXXXXXX"
        }
    }
}

token.delete

token.delete(id)

パラメーター

  • id int64 - token.listまたはtoken.generateが返したトークンID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "token.delete",
        "params": [
            11
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

タイマー

タイマーは、timer.listまたはtimer.addが返すIDで指定します。同じ名前で追加しても、新しいIDで登録されます。実行周期の書式はタイマーを参照してください。

timer.list

timer.list()

パラメーター

  • なし

戻り値

  • array<object<timer.Info>>|error - タイマー一覧
    • id:タイマーID
    • userName、execUser:タイマーを所有するユーザーと実行するユーザー
    • name:タイマー名
    • autoStart:自動起動するかどうか。falseの場合は省略されます
    • state:RUNNING、STARTING、STOP、STOPPING、FAILED、UNKNOWNのいずれか
    • task:実行するTQLファイルのパス
    • schedule:実行周期
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": [
            {
                "id": 9,
                "userName": "SYS",
                "execUser": "sys",
                "name": "_DOCGEN_UIAPI_TIMER",
                "state": "STOP",
                "task": "_docgen_uiapi_timer.tql",
                "schedule": "@every 1h"
            }
        ]
    }
}

timer.get

timer.get(id)

パラメーター

  • id int64 - タイマーID

戻り値

  • object<timer.Info>|error - タイマー情報。フィールドはtimer.listと同じです
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.get",
        "params": [
            9
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {
            "id": 9,
            "userName": "SYS",
            "execUser": "sys",
            "name": "_DOCGEN_UIAPI_TIMER",
            "state": "STOP",
            "task": "_docgen_uiapi_timer.tql",
            "schedule": "@every 1h"
        }
    }
}

timer.add

timer.add(req)

パラメーター

  • req object
    • name string - タイマー名。大文字に変換して保存されます
    • spec string - 実行周期。例:0 30 * * * *(毎時30分)、@every 1h30m(1時間30分ごと)、@daily(毎日)
    • command string - 実行するTQLファイルのパス。ファイルが存在しない場合はエラーを返します
    • autoStart bool - trueの場合は追加と同時に開始し、machbase-neoの起動時にも自動で開始します

戻り値

  • int64|error - 作成したタイマーのID
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.add",
        "params": [
            {
                "name": "_docgen_uiapi_timer",
                "spec": "@every 1h",
                "command": "_docgen_uiapi_timer.tql",
                "autoStart": false
            }
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": 9
    }
}

timer.update

idで指定したタイマーの設定を、リクエストの内容に置き換えます。

timer.update(req)

パラメーター

  • req object
    • id int64 - タイマーID
    • spec string - 実行周期
    • command string - 実行するTQLファイルのパス。省略するとエラーを返します
    • autoStart bool - 自動起動するかどうか。省略するとfalseになります

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.update",
        "params": [
            {
                "id": 9,
                "spec": "0 30 * * * *",
                "command": "_docgen_uiapi_timer.tql",
                "autoStart": true
            }
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

timer.delete

timer.delete(id)

パラメーター

  • id int64 - タイマーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.delete",
        "params": [
            9
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

timer.start

timer.start(id)

パラメーター

  • id int64 - タイマーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.start",
        "params": [
            9
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

timer.stop

timer.stop(id)

パラメーター

  • id int64 - タイマーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "timer.stop",
        "params": [
            9
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

サブスクライバー

サブスクライバーは、subscriber.listまたはsubscriber.addが返すIDで指定します。ブリッジの設定は、MQTTブリッジとNATSブリッジを参照してください。

subscriber.list

subscriber.list()

パラメーター

  • なし

戻り値

  • array<object<subscriber.Info>>|error - サブスクライバー一覧
    • id:サブスクライバーID
    • userName、execUser:サブスクライバーを所有するユーザーと実行するユーザー
    • name:サブスクライバー名
    • autoStart:自動起動するかどうか
    • state:RUNNING、STARTING、STOP、STOPPING、FAILED、UNKNOWNのいずれか
    • task:書き込み記述子
    • bridge:ブリッジ名
    • topic:購読するMQTTトピックまたはNATSサブジェクト
    • qos、queue、stream:ブリッジのオプション
    • autoStart、qos、queue、streamフィールドは、値がない場合は省略されます
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": [
            {
                "id": 4,
                "userName": "SYS",
                "execUser": "sys",
                "name": "_DOCGEN_UIAPI_SUBR",
                "state": "STOP",
                "task": "db/append/EXAMPLE:csv",
                "bridge": "_docgen_uiapi_mqtt",
                "topic": "_docgen_uiapi/sensor",
                "qos": 1
            }
        ]
    }
}

subscriber.get

subscriber.get(id)

パラメーター

  • id int64 - サブスクライバーID

戻り値

  • object<subscriber.Info>|error - サブスクライバー情報。フィールドはsubscriber.listと同じです
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.get",
        "params": [
            4
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {
            "id": 4,
            "userName": "SYS",
            "execUser": "sys",
            "name": "_DOCGEN_UIAPI_SUBR",
            "state": "STOP",
            "task": "db/append/EXAMPLE:csv",
            "bridge": "_docgen_uiapi_mqtt",
            "topic": "_docgen_uiapi/sensor",
            "qos": 1
        }
    }
}

subscriber.add

subscriber.add(req)

パラメーター

  • req object
    • name string - サブスクライバー名。大文字に変換して保存されます
    • bridge string - サブスクライバーが使用するブリッジ名
    • command string - 例:db/append/EXAMPLE:csv。書き込み記述子です。この例は、CSV形式で受信したデータをEXAMPLEテーブルにappendモードで書き込むことを表します
    • autoStart bool - trueにすると、machbase-neoとともにサブスクライバーも起動します
    • mqtt object - MQTTブリッジのオプション
      • topic string - 購読するトピック
      • qos int - トピック購読のQoSレベル。0と1に対応し、既定値は0です
    • nats object - NATSブリッジのオプション
      • subject string - 購読するサブジェクト
      • queue string - キューグループ
      • stream string - ストリーム名
  • name、bridge、commandとトピック(mqtt.topicまたはnats.subject)は必須です。
  • mqttとnatsは同時に指定できません。

戻り値

  • int64|error - 作成したサブスクライバーのID
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.add",
        "params": [
            {
                "name": "_docgen_uiapi_subr",
                "bridge": "_docgen_uiapi_mqtt",
                "command": "db/append/EXAMPLE:csv",
                "autoStart": false,
                "mqtt": {
                    "topic": "_docgen_uiapi/sensor",
                    "qos": 1
                }
            }
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": 4
    }
}

subscriber.update

idで指定したサブスクライバーの設定を、リクエストの内容に置き換えます。

subscriber.update(req)

パラメーター

  • req object
    • id int64 - サブスクライバーID
    • bridge、command、autoStart、mqtt、nats - subscriber.addと同じです

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.update",
        "params": [
            {
                "id": 4,
                "bridge": "_docgen_uiapi_mqtt",
                "command": "db/append/EXAMPLE:json",
                "autoStart": false,
                "mqtt": {
                    "topic": "_docgen_uiapi/sensor2",
                    "qos": 0
                }
            }
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

subscriber.delete

subscriber.delete(id)

パラメーター

  • id int64 - サブスクライバーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.delete",
        "params": [
            4
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

subscriber.start

subscriber.start(id)

パラメーター

  • id int64 - サブスクライバーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.start",
        "params": [
            4
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

subscriber.stop

subscriber.stop(id)

パラメーター

  • id int64 - サブスクライバーID

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "subscriber.stop",
        "params": [
            4
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

HTTP

http.debug.set

http.debug.set(m)

パラメーター

  • m object - enableとlogLatencyキーを持つデバッグ設定マップ

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "http.debug.set",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

http.split

http.split(content)

パラメーター

  • content string - HTTPスクリプトのテキスト

戻り値

  • array<object<util.HttpStatement>>|error - 解析したHTTP文の配列
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "http.split",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

セッション

session.list

session.list()

パラメーター

  • なし

戻り値

  • array<object<Session>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "session.list",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

session.kill

session.kill(id, force)

パラメーター

  • id string
  • force bool

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "session.kill",
        "params": [
            "string",
            false
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

session.stat

session.stat(reset)

パラメーター

  • reset bool

戻り値

  • object<server_api.Statz>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "session.stat",
        "params": [
            false
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

session.limit.get

session.limit.get()

パラメーター

  • なし

戻り値

  • object<SessionLimit>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "session.limit.get",
        "params": []
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

session.limit.set

session.limit.set(m)

パラメーター

  • m object

戻り値

  • null|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "session.limit.set",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": null
    }
}

SQL

sql.split

sql.split(content)

パラメーター

  • content string

戻り値

  • array<object<util.SqlStatement>>|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "sql.split",
        "params": [
            "string"
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": []
    }
}

LSP

lsp.diagnostics

lsp.diagnostics(req)

パラメーター

  • req object

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "lsp.diagnostics",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

lsp.completion

lsp.completion(req)

パラメーター

  • req object

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "lsp.completion",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

lsp.hover

lsp.hover(req)

パラメーター

  • req object

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "lsp.hover",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

lsp.signature

lsp.signature(req)

パラメーター

  • req object

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "lsp.signature",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}

lsp.metadata

lsp.metadata(req)

パラメーター

  • req object

戻り値

  • object|error
リクエスト・レスポンスのJSON

リクエスト

{
    "type": "rpc_req",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "method": "lsp.metadata",
        "params": [
            {}
        ]
    }
}

レスポンス

{
    "type": "rpc_rsp",
    "session": "client-session-#1",
    "rpc": {
        "jsonrpc": "2.0",
        "id": 20,
        "result": {}
    }
}
最終更新日