getNodeAPIConfiguration - 获取节点API配置
getNodeAPIConfiguration
调用返回节点的API配置信息。
调用参数
无
返回结果
getNodeAPIConfiguration
返回节点的API配置对象。
调用成功的HTTP状态码为200,响应示例如下:
{
"maxFindTransactions": 100000,
"maxRequestsList": 1000,
"maxGetTrytes": 10000,
"maxBodyLength": 1000000,
"testNet": true,
"milestoneStartIndex": 434525,
"duration": 1
}
调用失败的HTTP状态码为400,响应示例如下:
{
"error": "'command' parameter has not been specified"
}
示例代码
Python
import urllib2
import json
command = {"command": "getNodeAPIConfiguration"}
stringified = json.dumps(command)
headers = {
'content-type': 'application/json',
'X-IOTA-API-Version': '1'
}
request = urllib2.Request(url="http://localhost:14265", data=stringified, headers=headers)
returnData = urllib2.urlopen(request).read()
jsonData = json.loads(returnData)
print jsonData
Node.js
var request = require('request');
var command = {"command": "getNodeAPIConfiguration"}
var options = {
url: 'http://localhost:14265',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-IOTA-API-Version': '1',
'Content-Length': Buffer.byteLength(JSON.stringify(command))
},
json: command
};
request(options, function (error, response, data) {
if (!error && response.statusCode == 200) {
console.log(data);
}
});
命令行
curl http://localhost:14265 \
-X POST \
-H 'Content-Type: application/json' \
-H 'X-IOTA-API-Version: 1' \
-d '{"command": "getNodeAPIConfiguration"}'