Admin API
This API can be used for measuring node health and debugging. Note that the Admin API is disabled by default for security reasons. To run a node with the Admin API enabled, use command line argument --api-admin-enabled=true.

Format

This API uses the json 2.0 RPC format.

Endpoint

1
/ext/admin
Copied!

API 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

1
admin.alias({endpoint:string, alias:string}) -> {success:bool}
Copied!
    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

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.alias",
5
"params": {
6
"alias":"myAlias",
7
"endpoint":"bc/X"
8
}
9
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!
Now, calls to the X-Chain can be made to either /ext/bc/X 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

1
admin.aliasChain(
2
{
3
chain:string,
4
alias:string
5
}
6
) -> {success:bool}
Copied!
    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

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.aliasChain",
5
"params": {
6
"chain":"sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM",
7
"alias":"myBlockchainAlias"
8
}
9
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!
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

1
admin.getChainAliases(
2
{
3
chain:string
4
}
5
) -> {aliases:string[]}
Copied!
    chain is the blockchain’s ID.

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.getChainAliases",
5
"params": {
6
"chain":"sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM"
7
}
8
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"aliases": [
5
"X",
6
"avm",
7
"2eNy1mUFdmaxXNj1eQHUe7Np4gju9sJsEtWQ4MX3ToiNKuADed"
8
]
9
},
10
"id": 1
11
}
Copied!

admin.getLoggerLevel

Returns log and display levels of loggers.

Signature

1
admin.getLoggerLevel(
2
{
3
loggerName:string // optional
4
}
5
) -> {
6
loggerLevels: {
7
loggerName: {
8
logLevel: string,
9
displayLevel: string
10
}
11
}
12
}
Copied!
    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

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.getLoggerLevel",
5
"params": {
6
"loggerName": "C"
7
}
8
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"loggerLevels": {
5
"C": {
6
"logLevel": "DEBUG",
7
"displayLevel": "INFO"
8
}
9
}
10
},
11
"id": 1
12
}
Copied!

admin.lockProfile

Writes a profile of mutex statistics to lock.profile.

Signature

1
admin.lockProfile() -> {success:bool}
Copied!

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.lockProfile",
5
"params" :{}
6
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!

admin.memoryProfile

Writes a memory profile of the to mem.profile.

Signature

1
admin.memoryProfile() -> {success:bool}
Copied!

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.memoryProfile",
5
"params" :{}
6
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!

admin.setLoggerLevel

Sets log and display levels of loggers.

Signature

1
admin.setLoggerLevel(
2
{
3
loggerName: string, // optional
4
logLevel: string, // optional
5
displayLevel: string, // optional
6
}
7
) -> {success:bool}
Copied!
    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 omited at the same time.

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.setLoggerLevel",
5
"params": {
6
"loggerName": "C",
7
"logLevel": "DEBUG",
8
"displayLevel": "INFO"
9
}
10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!

admin.startCPUProfiler

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

Signature

1
admin.startCPUProfiler() -> {success:bool}
Copied!

Example Call

1
curl -X POST --data '{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"method" :"admin.startCPUProfiler",
5
"params" :{}
6
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Copied!

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!

admin.stopCPUProfiler

Stop the CPU profile that was previously started.

Signature

1
admin.stopCPUProfiler() -> {success:bool}
Copied!

Example Call

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

Example Response

1
{
2
"jsonrpc":"2.0",
3
"id" :1,
4
"result" :{
5
"success":true
6
}
7
}
Copied!
Last modified 2mo ago