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), including passwords, 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",
"showPassword":"false",
"searchCriterias": [
{"searchOption": "DEPARTMENT_SERIAL_NUMBER","searchTerms":"49"},
{"searchOption": "MONITORCONFIG_TYPE","searchTerms":"snmp"}]
}' https://localhost/api/json/admin/monitorConfig/list

 

# List all monitor configurations without passwords/communities

curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
"username":"superuser",
"password":"traverse",
"showPassword":"false"
}' 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 network discoveries

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

 

 

APPLIES TO 

Traverse version 9.1 and later.

REFERENCE

None.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Contact us