-
Notifications
You must be signed in to change notification settings - Fork 4
API Documentation
The root context path for all the ICCR Restful APIs resources is /iccr/rs. All responses to HTTP GET operations return JSON objects. All HTTP PUT operations that update server side properties require the payload in JSON format. There are no HTTP POST operations that create new server side objects. The ICCR Restful APIs only uses HTTP POST operations as a means to initiate a longer running action that has intended side effects such as stopping or starting the IOTA IRI or downloading a new IOTA IRI version.
All access of the ICCR Restful API is subject to authorization. Each request to the API must have an HTTP header entry ICCR-API-KEY with the value set to the value of the iccrApiKey property in the iccr.properties file. If a given HTTP request does not have an ICCR-API-KEY or if the ICCR-API-KEY header value does not match the configured value of the iccr.properties iccrApiKey, the request will be refused with an HTTP unauthorized status code.
Usage notes:
when the ICCR neighbors configuration property is updated, the updated neighbors will be automatically added to the IOTA IRI process; when the IOTA download operation is done, the IOTA IRI process will be automatically started after download completes; The ICCR's ReST API is defined by the following resource paths:
Method : Get
URI : http(s)://:ip:port/iccr/rs/app/config
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
{
"properties": [{
"key": "iccrPortNumber",
"value": "14266"
}, {
"key": "iotaPortNumber",
"value": "14265"
}, {
"key": "iotaDownloadLink",
"value": "http://85.93.93.110/iri-1.1.2.3.jar"
}, {
"key": "iotaDir",
"value": "/opt/iota"
}, {
"key": "iotaStartCmd",
"value": "java -jar IRI.jar -p"
}, {
"key": "iotaNeighborRefreshTime",
"value": "10"
}]
}Method : Get
URI : http(s)://:ip:port/iccr/rs/app/config/<config-name>
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
{
"key": "iccrPortNumber",
"value": "14266"
}Method : Put
URI : http(s)://:ip:port/iccr/rs/app/config/<config-name>
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Request body :
{
"key": "iccrPortNumber",
"value": 14266
}Response body :
{
"success": true,
"msg": "properties updated successfully"
}Method : Get
URI : http(s)://:ip:port/iccr/rs/app/config/iota/nbrs
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
{
"key": "iotaNeighbors",
"nbrs": [{
"active": true,
"descr": "David Neighbor Node",
"key": "david",
"name": "nbr-David",
"uri": "udp://192.168.0.0.1:14265",
"numAt": 0,
"numIt": 0,
"numNt": 0
}, {
"active": true,
"descr": "Johan Neighbor Node",
"key": "johan",
"name": "nbr-Johan",
"uri": "udp://192.168.0.0.2:14265",
"numAt": 0,
"numIt": 0,
"numNt": 0
}, {
"active": true,
"descr": "Sebastian Neighbor Node",
"key": "sebastian",
"name": "nbr-sebastian",
"uri": "udp://192.168.0.0.3:14265",
"numAt": 0,
"numIt": 0,
"numNt": 0
}]
}Method : Put
URI : `http(s)://:ip:port/iccr/rs/app/config/iota/nbrs
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Request body :
{
"key": "iccrPortNumber",
"value": 14266
}Request body :
{
"key": "iotaNeighbors",
"nbrs": [{
"key": "do1",
"name": "do1",
"descr": "do1",
"uri": "udp://123.237.239.166:14265",
"active": true
}, {
"key": "do2",
"name": "do2",
"descr": "do2",
"uri": "udp://44.56.171.97:14265",
"active": true
}]
}Method : Put
URI : `http(s)://:ip:port/iccr/rs/iccr/cmd/
Possible values: start, stop, status, restart
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Request body : NaN
Response body :
{
"success": true,
"msg": "process executed successfully",
"properties": [{
"key": "resultCode",
"value": "0"
}, {
"key": "restartIccr",
"value": "true"
}]
}Method : Put
URI : `http(s)://:ip:port/iccr/rs/iccr/cmd/
Possible values: start, stop, status, restart, delete, removeNeighbors, addNeighbors, deletedb
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Request body : NaN
Response body :
{
"success": true,
"msg": "process executed successfully",
"properties": [{
"key": "resultCode",
"value": "0"
}, {
"key": "stopIota",
"value": "true"
}]
}Method : Get
URI : http(s)://:ip:port/iccr/rs/iota/cmd/nodeinfo
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
{
"success": true,
"msg": "success",
"content": {
"appName": "IRI",
"appVersion": "1.1.2.3",
"jreAvailableProcessors": 2,
"jreFreeMemory": 51286960,
"jreVersion": "1.8.0_111",
"jreMaxMemory": 883949568,
"jreTotalMemory": 60293120,
"latestMilestone": "999999999999999999999999999999999999999999999999999999999999999999999999999999999",
"latestMilestoneIndex": 13250,
"latestSolidSubtangleMilestone": "999999999999999999999999999999999999999999999999999999999999999999999999999999999",
"latestSolidSubtangleMilestoneIndex": 13250,
"neighbors": 2,
"packetsQueueSize": 0,
"time": 1485749319938,
"tips": 1,
"transactionsToRequest": 0,
"duration": 2
},
"properties ": [{
"key ": "getIotaNodeInfo ",
"value ": "true "
}]
}Method : Get
URI : http(s)://:ip:port/iccr/rs/iota/cmd/neighbors
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
{
"success": true,
"msg": "success",
"content": {
"neighbors": [{
"address ": "234.237 .239 .166: 14265 ",
"numberOfAllTransactions ": 0,
"numberOfNewTransactions ": 0,
"numberOfInvalidTransactions ": 0
}, {
"address ": "44.56 .171 .97: 14265 ",
"numberOfAllTransactions ": 0,
"numberOfNewTransactions ": 0,
"numberOfInvalidTransactions ": 0
}],
"duration ": 1
},
"properties": [{
"key": "getIotaNeighbors",
"value": "true"
}]
}Method : Get
URI : http(s)://:ip:port/iccr/rs/app/eventlog
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
["2017-01-29T20:54:38.956,restart ICCR,/opt/iccr/bin/restarticcr.bash", "2017-01-29T21:09:58.515,stop,", "2017-01-29T21:09:58.515,delete IOTA,", "2017-01-29T21:54:56.885,download,http://85.93.93.110/iri-1.1.2.3.jar,/opt/iccr/download/iri-1.1.2.3.jar.20170129215453 (5476643 bytes)", "2017-01-29T21:54:56.945,install,/opt/iccr/download/iri-1.1.2.3.jar.20170129215453,/opt/iota/IRI.jar", "2017-01-29T21:54:59.06,IOTA addNeighbors"]Method : Get
URI : http(s)://:ip:port/iccr/rs/iota/log?fileDirection=<head/tail>
Normal Response codes : 200
Error response codes : 500, 401
Request header : Content-Type : application/json
Response (bodies) :
{
"success": true,
"msg": "",
"lines": ["22:07:36.467 [main] INFO com.iota.iri.IRI - Welcome to IRI 1.1.2.3", "22:07:36.530 [main] ERROR com.iota.iri.IRI - Impossible to display logo. Charset UTF8 not supported by terminal.", "22:07:36.558 [pool-2-thread-1] INFO com.iota.iri.service.Node - Spawning Receiver Thread", "22:07:36.564 [pool-2-thread-2] INFO com.iota.iri.service.Node - Spawning Broadcaster Thread", "22:07:36.567 [pool-2-thread-3] INFO com.iota.iri.service.Node - Spawning Tips Requester Thread", "22:07:36.569 [pool-2-thread-4] INFO com.iota.iri.service.Node - Spawning Neighbor DNS Refresher Thread", "22:07:36.569 [pool-2-thread-4] INFO com.iota.iri.service.Node - Checking Neighbors' Ip...", "22:07:36.816 [main] INFO com.iota.iri.IRI - IOTA Node initialised correctly.", "22:07:38.311 [XNIO-1 task-1] INFO com.iota.iri.service.API - # 1 -> Requesting command 'addNeighbors'", "22:08:13.389 [XNIO-1 task-2] INFO com.iota.iri.service.API - # 2 -> Requesting command 'getNeighbors'"],
"lastFilePosition": 939,
"lastFileSize": 2340
}