Follow

Tip: How to access the REST API

 

The REST API allows authenticated access to many of Traverse's features in the form of URL encoded requests.

First it is necessary to login using valid Traverse credentials via a URL in a Web Browser:

https://10.10.10.10/api/rest/command/login?superuser/traverse

OK 201 request accepted and processed, ready for next request

Once authenticated, we may issue any of the BVE API style commands, such as:

https://10.10.10.10/api/rest/command/test.list?deviceName=Traverse Server&testType=jmx&subType=nv_msgsvr_event_reject

With a response of:

OK 203 request accepted, records returned: 3
"serialNumber=90040", "testName=Number Of Messages Discarded (By Rule)", "testType=jmx", "subType=nv_msgsvr_event_reject", "deviceName=Traverse Server", "accountName=Core Infrastructure", "jmxremotePort=7693", "protocol=IIOP", "remoteApplicationDomainName=", "loginName=", "interval=300", "warningThreshold=5000", "criticalThreshold=20000", "shadowWarningThreshold=5000", "shadowCriticalThreshold=20000", "slaThreshold=5000", "units=msgs/min", "actionName=None", "scheduleName=Default Schedule", "flapPreventionWaitCycles=0", "thresholdType=1", "suppressed=false", "isSuspended=false", "timeBasedThresholds=false", "resultProcessDirective=3", "resultMultiplier=60.0", "maxValue=100000","jmxProperty=NetVigil:type=MessageServer|MessagesDiscardedByRule"
"serialNumber=90029", "testName=Number Of Messages Discarded (No Match)", "testType=jmx", "subType=nv_msgsvr_event_reject", "deviceName=Traverse Server", "accountName=Core Infrastructure", "jmxremotePort=7693", "protocol=IIOP", "remoteApplicationDomainName=", "loginName=", "interval=300", "warningThreshold=5000", "criticalThreshold=20000", "shadowWarningThreshold=5000", "shadowCriticalThreshold=20000", "slaThreshold=5000", "units=msgs/min", "actionName=None", "scheduleName=Default Schedule", "flapPreventionWaitCycles=0", "thresholdType=1", "suppressed=false", "isSuspended=false", "timeBasedThresholds=false", "resultProcessDirective=3", "resultMultiplier=60.0", "maxValue=100000","jmxProperty=NetVigil:type=MessageServer|MessagesDiscardedNoMatchingRule"
"serialNumber=90020", "testName=Number Of Messages Discarded (Unknown Device)", "testType=jmx", "subType=nv_msgsvr_event_reject", "deviceName=Traverse Server", "accountName=Core Infrastructure", "jmxremotePort=7693", "protocol=IIOP", "remoteApplicationDomainName=", "loginName=", "interval=300", "warningThreshold=5000", "criticalThreshold=20000", "shadowWarningThreshold=5000", "shadowCriticalThreshold=20000", "slaThreshold=5000", "units=msgs/min", "actionName=None", "scheduleName=Default Schedule", "flapPreventionWaitCycles=0", "thresholdType=1", "suppressed=false", "isSuspended=false", "timeBasedThresholds=false", "resultProcessDirective=3", "resultMultiplier=60.0", "maxValue=100000","jmxProperty=NetVigil:type=MessageServer|MessagesDiscardedNoMatchingDevice"

 

Output may also be presented in JSON format by including the '&format=json' parameter in the request:

https://10.10.10.10/api/rest/command/device.list?deviceName=Traverse Server&format=json

 with a response of:

{"api-response":{"data":{"object":[{"serialNumber":"80018","deviceName":"Traverse Server","address":"127.0.0.1","deviceType":"Linux/Other Unix","parentNames":"","tag1 (Tag 1)":"","tag2 (Tag 2)":"","tag3 (Tag 3)":"","tag4 (Tag 4)":"","tag5 (Tag 5)":"","locationName":"Corporate","dgeName":"dge-1","isSuspended":"false","clearOnOk":"false","smartNotify":"true","showOnSummary":"true","accountSerialNumber":"49","accountName":"Core Infrastructure","isReadOnly":"false","model":"2.6.32-573.7.1.el6.x86_64","vendor":"Linux","rediscoveryEnabled":"false","configBackupEnabled":"false","processCollectionEnabled":"true","flapPreventionWaitCycles":"-1","comment":"Performance of Kaseya Traverse running on the local server"}]},"status":{"code":"203","error":"false","message":"request accepted, records returned: 1"}}}

 Using a formatter such as  'http://jsonviewer.stack.hu/' better reveals the structure of the response:

{
  "api-response": {
    "data": {
      "object": [
        {
          "serialNumber": "80018",
          "deviceName": "Traverse Server",
          "address": "127.0.0.1",
          "deviceType": "Linux/Other Unix",
          "parentNames": "",
          "tag1 (Tag 1)": "",
          "tag2 (Tag 2)": "",
          "tag3 (Tag 3)": "",
          "tag4 (Tag 4)": "",
          "tag5 (Tag 5)": "",
          "locationName": "Corporate",
          "dgeName": "dge-1",
          "isSuspended": "false",
          "clearOnOk": "false",
          "smartNotify": "true",
          "showOnSummary": "true",
          "accountSerialNumber": "49",
          "accountName": "Core Infrastructure",
          "isReadOnly": "false",
          "model": "2.6.32-573.7.1.el6.x86_64",
          "vendor": "Linux",
          "rediscoveryEnabled": "false",
          "configBackupEnabled": "false",
          "processCollectionEnabled": "true",
          "flapPreventionWaitCycles": "-1",
          "comment": "Performance of Kaseya Traverse running on the local server"
        }
      ]
    },
    "status": {
      "code": "203",
      "error": "false",
      "message": "request accepted, records returned: 1"
    }
  }
}

 

Lastly, we should logout to end our session:

https://10.10.10.10/api/rest/command/login?superuser/traverse

Note:  As we have used 'https' to access the Traverse REST API, the communication is encrypted, instead of the clear text access to the BVE Flex API.

Please review the Traverse Developer Guide for additional details on the various Traverse APIs.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

1 Comments

Please sign in to leave a comment.