Home

Admin API

The admin api allows clients to examine dijets node's internal state, its set of connections, and similar internal protocol data.

Format#

This API uses the json 2.0 RPC format. For details, see here.

Endpoint#


_10
/ext/admin

Methods#

admin.alias#

Assign an API endpoint an alias, a different endpoint for the API. The original endpoint will still work. This change only affects this node; other nodes will not know about this alias.

Signature:


_10
admin.alias({endpoint:string, alias:string}) -> {}

  • endpoint is the original endpoint of the API. endpoint should only include the part of the endpoint after /ext/.
  • The API being aliased can now be called at ext/alias.
  • alias can be at most 512 characters.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.alias",
_10
"params": {
_10
"alias":"myAlias",
_10
"endpoint":"bc/V"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}

Now, calls to the Value Chain can be made to either /ext/bc/V or, equivalently, to /ext/myAlias.

admin.aliasChain#

Give a blockchain an alias, a different name that can be used any place the blockchain’s ID is used.

Signature:


_10
admin.aliasChain(
_10
{
_10
chain:string,
_10
alias:string
_10
}
_10
) -> {}

  • chain is the blockchain’s ID.
  • alias can now be used in place of the blockchain’s ID (in API endpoints, for example.)

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.aliasChain",
_10
"params": {
_10
"chain":"sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM",
_10
"alias":"myBlockchainAlias"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}

Now, instead of interacting with the blockchain whose ID is sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM by making API calls to /ext/bc/sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM, one can also make calls to ext/bc/myBlockchainAlias.

admin.getChainAliases#

Returns the aliases of the chain

Signature:


_10
admin.getChainAliases(
_10
{
_10
chain:string
_10
}
_10
) -> {aliases:string[]}

  • chain is the blockchain’s ID.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.getChainAliases",
_10
"params": {
_10
"chain":"sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_11
{
_11
"jsonrpc": "2.0",
_11
"result": {
_11
"aliases": [
_11
"X",
_11
"avm",
_11
"2eNy1mUFdmaxXNj1eQHUe7Np4gju9sJsEtWQ4MX3ToiNKuADed"
_11
]
_11
},
_11
"id": 1
_11
}

admin.getLoggerLevel#

Returns log and display levels of loggers.

Signature:


_12
admin.getLoggerLevel(
_12
{
_12
loggerName:string // optional
_12
}
_12
) -> {
_12
loggerLevels: {
_12
loggerName: {
_12
logLevel: string,
_12
displayLevel: string
_12
}
_12
}
_12
}

  • loggerName is the name of the logger to be returned. This is an optional argument. If not specified, it returns all possible loggers.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.getLoggerLevel",
_10
"params": {
_10
"loggerName": "C"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_12
{
_12
"jsonrpc": "2.0",
_12
"result": {
_12
"loggerLevels": {
_12
"C": {
_12
"logLevel": "DEBUG",
_12
"displayLevel": "INFO"
_12
}
_12
}
_12
},
_12
"id": 1
_12
}

admin.loadVMs#

Dynamically loads any virtual machines installed on the node as plugins.

Signature:


_10
admin.loadVMs() -> {
_10
newVMs: map[string][]string
_10
failedVMs: map[string]string,
_10
}

  • failedVMs is only included in the response if at least one virtual machine fails to be loaded.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.loadVMs",
_10
"params" :{}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_12
{
_12
"jsonrpc": "2.0",
_12
"result": {
_12
"newVMs": {
_12
"tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH": ["foovm"]
_12
},
_12
"failedVMs": {
_12
"rXJsCSEYXg2TehWxCEEGj6JU2PWKTkd6cBdNLjoe2SpsKD9cy": "error message"
_12
}
_12
},
_12
"id": 1
_12
}

admin.lockProfile#

Writes a profile of mutex statistics to lock.profile.

Signature:


_10
admin.lockProfile() -> {}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.lockProfile",
_10
"params" :{}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}

admin.memoryProfile#

Writes a memory profile of the to mem.profile.

Signature:


_10
admin.memoryProfile() -> {}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.memoryProfile",
_10
"params" :{}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}

admin.setLoggerLevel#

Sets log and display levels of loggers.

Signature:


_10
admin.setLoggerLevel(
_10
{
_10
loggerName: string, // optional
_10
logLevel: string, // optional
_10
displayLevel: string, // optional
_10
}
_10
) -> {}

  • loggerName is the logger's name to be changed. This is an optional parameter. If not specified, it changes all possible loggers.
  • logLevel is the log level of written logs, can be omitted.
  • displayLevel is the log level of displayed logs, can be omitted.

logLevel and displayLevel cannot be omitted at the same time.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.setLoggerLevel",
_10
"params": {
_10
"loggerName": "C",
_10
"logLevel": "DEBUG",
_10
"displayLevel": "INFO"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}

admin.startCPUProfiler#

Start profiling the CPU utilization of the node. To stop, call admin.stopCPUProfiler. On stop, writes the profile to cpu.profile.

Signature:


_10
admin.startCPUProfiler() -> {}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.startCPUProfiler",
_10
"params" :{}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}

admin.stopCPUProfiler#

Stop the CPU profile that was previously started.

Signature:


_10
admin.stopCPUProfiler() -> {}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"admin.stopCPUProfiler"
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {}
_10
}