JSON-RPC:Server

The  JSON RPC calls can list and retrieve information about servers, rehash the server, connect/disconnect servers, etc.

IMPORTANT: server.* API calls require UnrealIRCd 6.0.6-git or later

= Structure of a server object = A "Server object" is used in responses. In case of  API calls the result in response will always be a server (never a normal user).

NOTE: Above is the general description. If you want to deal with users, use the  API calls.

= API Calls =

server.list
List servers.

Request arguments
No mandatory arguments

Example
{"jsonrpc": "2.0", "method": "server.list", "params": {}, "id": 123}

server.get
Retrieve all details of a single server.

Request arguments
Optional argument:
 * server: the server name (or the SID). If not specified then the current server is assumed (the one you connect to via the JSON-RPC API).

Example
{"jsonrpc": "2.0", "method": "server.get", "params": {"server":"irc1.example.net"}, "id": 123}

server.rehash
Rehash the server.

IMPORTANT: If all servers on your network have  included then this can return an object with full rehash details. Otherwise, for remote rehashes a simple boolean 'true' result is returned.

Request arguments
Optional arguments:
 * server: the server name (or SID). If not specified then the current server is assumed (the one you connect to via the JSON-RPC API).

Result
For local servers and remote servers that support RPC, this request may take a few seconds and you will receive a rehash object with the full rehash details:
 * rehash_client: the person who initiated the request (normally you, not very useful)
 * success: this is  if the REHASH succeeded, or   if there was some config error
 * log: this is the full rehash log as an array of JSON log items.

For remote servers that do not support RPC:
 * A simple boolean result

Example
{"jsonrpc": "2.0", "method": "server.rehash", "params": {}, "id": 123}

Example response: { "jsonrpc": "2.0", "method": "server.rehash", "id": 123, "result": { "rehash_client": { "name": "RPC:local", "id": "001JGJ30G", "hostname": "127.0.0.1", "ip": "127.0.0.1", "server_port": 0, "details": "RPC:local@127.0.0.1", "connected_since": "2023-01-11T16:16:15.000Z", "idle_since": "2023-01-11T16:16:15.000Z" },   "log": [ {       "timestamp": "2023-01-11T16:16:15.659Z", "level": "info", "subsystem": "config", "event_id": "CONFIG_INFO_GENERIC", "log_source": "maintest.test.net", "msg": "Loading IRCd configuration..", "source": { "file": "conf.c", "line": 1476, "function": "config_status" }     },      {        "timestamp": "2023-01-11T16:16:16.545Z", "level": "info", "subsystem": "config", "event_id": "CONFIG_INFO_GENERIC", "log_source": "maintest.test.net", "msg": "Testing IRCd configuration..", "source": { "file": "conf.c", "line": 1476, "function": "config_status" }     },      {        "timestamp": "2023-01-11T16:16:24.727Z", "level": "info", "subsystem": "config", "event_id": "CONFIG_LOADED", "log_source": "maintest.test.net", "msg": "Configuration loaded", "source": { "file": "conf.c", "line": 2142, "function": "config_test" }     }    ],    "success": true } }

server.connect
Make server link (connect) to another server.

Request arguments
Mandatory argument:
 * link: the server name to link to

Right now you can only tell to link to servers from the directly connected server (the one you are issuing JSON-RPC calls to), you cannot (yet) tell remote server B to link to server C.

Example
{"jsonrpc": "2.0", "method": "server.connect", "params": {"link":"irc2.example.net"}, "id": 123}

server.disconnect
Terminate a server link (disconnect).

This works for both directly connected servers and remote servers further up the network.

Request arguments
Mandatory argument:
 * link: the server name to unlink from

Example
{"jsonrpc": "2.0", "method": "server.disconnect", "params": {"link":"irc2.example.net"}, "id": 123}

server.module_list
Get the module list (list of loaded modules) on a server.

IMPORTANT: This only works with remote servers if all servers on your network have  included. This is because then the JSON-RPC request/response is forwarded over the IRC network.

Request arguments
Optional argument:
 * server: the server name (or the SID). If not specified then the current server is assumed (the one you connect to via the JSON-RPC API).

Response object
TODO: document

Example
{"jsonrpc": "2.0", "method": "server.module_list", "params": {"server":"irc1.example.net"}, "id": 123}