Traverse Example Web Services Requests

QUESTION

How to send a request to the Traverse Web Services API?

 

RESOLUTION

In the examples below,  replace 'superuser', 'traverse' with the appropriate Traverse credentials; and replace 'localhost' with the name or IP address of a Traverse Web Application.

Note; 'curl' is a command generally available on *nix systems for sending HTTP requests. There is also a version available for download for Windows. 

# List users

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse"
}' https://localhost/api/json/admin/user/getCurrentUser

# License information

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse"
}' https://localhost/api/json/admin/system/getLicenses
 

# Acknowledged Events by event time

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
  "username":"superuser",
  "password":"traverse",
  "usernameFilter":"superuser",
  "departmentSerialNumbers":[
  ],
  "deviceSerialNumbers":[
  ],
  "severities":[
  ],
  "startTimeExp":"2-days-ago",
  "endTimeExp":"now"
}' https://localhost/api/json/event/getEventAckDetails

 

# Acknowledged Events for some severities by acknowledged time

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
  "username":"traverse",
  "password":"traverse",
  "usernameFilter":"traverse",
  "departmentSerialNumbers":[
  ],
  "deviceSerialNumbers":[
  ],
  "severities":[
    524288,
    8388608,
    134217728
  ],
  "startAckTimeExp":"30-days-ago",
  "endAckTimeExp": "now"
}' https://localhost/api/json/event/getEventAckDetails

 

# List all composite tests

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"searchCriterias":[
{"searchOption":"TEST_TYPE",
"searchTerms":"composite"}
],
"sorting":{"sortField":"testStatus",
"sortDirection":"DESC"}
}' https://localhost/api/json/test/getStatuses

# List all suspended tests

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"searchCriterias":[
{"searchOption":"TEST_STATUS",
"searchTerms":"suspended"}
]
}' https://localhost/api/json/test/getStatuses

# Current process metrics

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"serialNumber":99999,
"metrics":["cpu","memory","disk_io"]
}' https://localhost/api/json/process/getCurrent

 

# List all the SNMP type monitor configurations (also known as shared and local credentials), in the department where the serial number is '49'

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"searchCriterias": [
{"searchOption": "DEPARTMENT_SERIAL_NUMBER","searchTerms":"49"},
{"searchOption": "MONITORCONFIG_TYPE","searchTerms":"snmp"}]
}' https://localhost/api/json/admin/monitorConfig/list

 

# Create SNMPv2 shared monitor configuration

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"monitorConfig": {
"serialNumber": "",
"name": "Sample SNMPv2 Shared Credentials",
"type": "snmp",
"parameters": [
{
"name": "agentVersion",
"label": "SNMP Version",
"value": "2",
"type": "NUMBER"
},
{
"name": "agentCommunity",
"label": "SNMP Community String",
"value": "public",
"type": "TEXT"
},
{
"name": "agentCommunity-2",
"label": "SNMP Community String (again)",
"value": "public",
"type": "TEXT"
},
{
"name": "agentPort",
"label": "SNMP Agent Port",
"value": "161",
"type": "NUMBER"
},
{
"name": "agentBatchMode",
"label": "SNMP Query Optimization",
"value": "1",
"type": "NUMBER"
},
{
"name": "v3User",
"label": "SNMPv3 User",
"value": "",
"type": "TEXT"
},
{
"name": "v3AuthPassword",
"label": "SNMPv3 Auth Password",
"value": "",
"type": "TEXT"
},
{
"name": "v3AuthPassword-2",
"label": "SNMPv3 Auth Password (again)",
"value": "",
"type": "TEXT"
},
{
"name": "v3PrivPassword",
"label": "SNMPv3 Priv Password",
"value": "",
"type": "TEXT"
},
{
"name": "v3PrivPassword-2",
"label": "SNMPv3 Priv Password (again)",
"value": "",
"type": "TEXT"
},
{
"name": "v3AuthProto",
"label": "SNMPv3 Authentication Protocol",
"value": "1",
"type": "NUMBER"
},
{
"name": "v3PrivProto",
"label": "SNMPv3 Encryption Protocol",
"value": "1",
"type": "NUMBER"
}
],
"accountName": "ACME"
}
}'

 

# Create WMI shared monitor configuration

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"monitorConfig": {
"serialNumber": "",
"name": "Sample WMI Shared Credentials",
"type": "wmi",
"parameters": [
{
"name": "username",
"label": "Domain\\Username",
"value": ".\\Administrator",
"type": "TEXT"
},
{
"name": "password",
"label": "Password",
"value": "password_value_here",
"type": "TEXT"
},
{
"name": "password-2",
"label": "Password (again)",
"value": "password_value_here",
"type": "TEXT"
}
],
"accountName": "ACME"
}
}'

 

# List all monitor configurations

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
}' https://localhost/api/json/admin/monitorConfig/list

 

# List SLAs

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"traverse",
"password":"traverse"
}' https://localhost/api/json/sla/getMeasurements

 

# List SLA measurements

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"traverse",
"password":"traverse"
"slaMeasurementId":"730356",
"granularityParam":
{"unit":"Day",
"value":1
},
"skipLastResults": 0,
"maxResults": 7
}' https://localhost/api/json/sla/getMeasurements

 

# List test results

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"traverse",
"password":"traverse",
"startTime":"1514764800000",
"endTime":"1522540799000",
"searchCriterias":[
{"searchOption":"TEST_SERIAL_NUMBER","searchTerms":"257399"}]
}' https://localhost/api/json/test/getRawHistoricalData

 

# List current events

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"traverse",
"password":"traverse",
"startTimeExp": "1-minutes-ago",
"endTimeExp": "now",
"messageSeverities": [
8388608,
134217728,
1073741824,
16384,
32768,
524288,
2048,
8,
128
],
"sorting": {
"sortDirection": "DESC",
"sortField": "newTimestamp"
}
}' https://localhost/api/json/event/getMessages

 

# Create a ruled based test container of tests named 'Packet Loss'

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
 "username":"traverse",
"password":"traverse",
"parentContainerSerialNumber":0,
  "containerDetail":{"name":"Packet Loss container","type":"test","comment":"","commentVisible":false,"actionProfileSerialNumber":-1,"members":null,"rules":[
  {"searchOption":"DEVICE_NAME","searchTerms":""},
  {"searchOption":"DEVICE_ADDRESS","searchTerms":""},
  {"searchOption":"DEVICE_MODEL","searchTerms":""},
  {"searchOption":"DEVICE_TYPE","searchTerms":""},
  {"searchOption":"VENDOR_NAME","searchTerms":""},
  {"searchOption":"TAG_1","searchTerms":""},
  {"searchOption":"TAG_2","searchTerms":""},
  {"searchOption":"TAG_3","searchTerms":""},
  {"searchOption":"TAG_4","searchTerms":""},
  {"searchOption":"TAG_5","searchTerms":""},
  {"searchOption":"TEST_NAME","searchTerms":"Packet Loss"},
  {"searchOption":"TEST_TYPE","searchTerms":""},
  {"searchOption":"TEST_SUB_TYPE","searchTerms":""},
  {"searchOption":"ELEMENT_NAME","searchTerms":""},
  {"searchOption":"ELEMENT_CATEGORY","searchTerms":""}],
  "severityRule":null,"useMessageEvents":false}
}' https://localhost/api/json/admin/container/create

 

# List devices that are not members of a container

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"traverse",
"password":"traverse",
  "includeHealth":false,
"includeOnlineStatus":false,
"searchCriterias":[
{"searchOption":"PARENT_CONTAINER_SERIAL_NUMBER","searchTerms":"-1"}
]
}' https://localhost/api/json/device/getStatuses

 

# List first 50 network discovery sessions

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
 "username":"superuser",
"password":"traverse",
"searchCriterias":[],"sorting":{"sortDirection":"ASC","sortField":"sessionName"},
"paging":{"page":0,"limit":50}}'
}' https://localhost/api/json/discovery/getSessions

 

# List first 100 tests in the 'Core Infrastructure' department

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
 "username":"superuser",
"password":"traverse",
"searchCriterias":[{"searchOption":"DEPARTMENT_SERIAL_NUMBER","searchTerms":"49"}],
"fieldsRequested":["DEPARTMENT_NAME","DEVICE_NAME","UNITS","TEST_TYPE","TEST_SUB_TYPE","TEST_INTERVAL","ACTION_PROFILE_NAME","SUSPENDED","WARNING_THRESHOLD","CRITICAL_THRESHOLD"],
"paging":{"page":0,"limit":100}}'
}' https://localhost/api/json/test/getStatuses

 

#Adding and removing one device dependency.

curl -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"accountSerialNumber":"DEPARTMENT_SERIAL_NUMBER",
"username":"traverse",
"password":"traverse",
"addDependencies":[{"childId":"CHILD_DEVICE_SERIAL_NUMBER","parentId":"PARENT_DEVICE_SERIAL_NUMBER"}],
"removeDependencies":[{"childId":"CHILD_DEVICE_SERIAL_NUMBER","parentId":"PARENT_DEVICE_SERIAL_NUMBER"}]
}' http://localhost/api/json/admin/device/updateDeviceDependency

 

APPLIES TO 

Traverse version 9.1 and later.

REFERENCE

None.

Have more questions?

Contact us

Was this article helpful?
0 out of 0 found this helpful

Provide feedback for the Documentation team!

Browse this section