Follow

Using JSON with Traverse

Traverse supports JSON requests for several SOAP Web Services endpoints.

See http://kaseyasupport.kaseyacloud.com/api.jsp

 

In this example, we will get the test historical data for one test

NOTE: Replace 

* http://kaseyasupport.kaseyacloud.com with the URL for your server

* auser with the appropriate user

* apassword with the appropriate password

 

http://kaseyasupport.kaseyacloud.com/api/json/test?_wadl&_type=xml

We will use the getRawHistoricalData function

Using JSON from the web browser:

Install the 'Postman - Rest Client' extension - https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm

Access the extension as in - chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm/index.html

Configure the settings as shown in this image here:

postman.PNG

 To fill out the form:

Specify the URL - http://kaseyasupport.kaseyacloud.com/api/json/test/getRawHistoricalData

Pick POST from the dropdown

Click Headers(0) - top right

Click on the Header area in the Header Value pair

Start typing acc and select Acceot; for the Value, type application/json

Click on the nextHeader area in the Header Value pair

Start typing con and select Content-Type; for the Value, type application/json

 Click on raw

In the drop down next to raw, select JSON

Enter the data:

{ "username":"auser", "password":"apassword", "startTimeExp":"1-hours-ago", "endTimeExp":"now", "searchCriterias": [ { "searchOption": "TEST_SERIAL_NUMBER", "searchTerms": "990219" } ] }

and click on Send

The lower pane should populate with results as in:

 {"success":true,"errorCode":null,"errorMessage":null,"timestamp":1442024573243,"timestampStr":"Friday, 11 September 2015 19:22:53 o'clock PDT","result":{"historicalData":[{"testSerialNumber":990219,"deviceSerialNumber":990193,"accountSerialNumber":49,"testName":"Round Trip Time","deviceName":"DGE01","accountName":"Core Infrastructure","units":"ms","thresholdType":1,"percentile95":1.0,"percentile98":1.0,"minValue":1.0,"maxValue":1.0,"stdDev":0.0,"mean":1.0,"values":[{"timestamp":1442021095880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":1442021395880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442021695880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442021995880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":1442022295880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442022595880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442022895880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":1442023195880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442023495880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442023795880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":1442024095880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442024395880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2}]}]}}

 

 

Using JSON with curl from a Linux prompt looks like:

 
curl -k -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
  "username":"auser",
  "password":"apassword",
  "startTimeExp":"1-hours-ago",
  "endTimeExp":"now",
  "searchCriterias": [
    {
      "searchOption": "TEST_SERIAL_NUMBER",
      "searchTerms": "990219"
    }
  ]
}' https://kaseyasupport.kaseyacloud.com/api/json/test/getRawHistoricalData

The response is

 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: TraverseJSessionID=05C2A2024798AD20BB72A020CFA889AE; Path=/; HttpOnly
Date: Sat, 12 Sep 2015 01:27:18 GMT
Content-Type: application/json
Content-Length: 2250

{"success":true,"errorCode":null,"errorMessage":null,"timestamp":1442021238429,"timestampStr":"Friday, 11 September 2015 18:27:18 o'clock PDT",
"result":{"historicalData":[{"testSerialNumber":990219,"deviceSerialNumber":990193,"accountSerialNumber":49,"testName":"Round Trip Time","deviceName":"DGE01",
"accountName":"Core Infrastructure","units":"ms","thresholdType":1,"percentile95":1.0,"percentile98":1.0,"minValue":1.0,"maxValue":1.0,"stdDev":0.0,"mean":1.0,"values":[
{"timestamp":1442017855880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442018155880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},
{"timestamp":1442018455880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442018755880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442019055880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},
{"timestamp":1442019355880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442019655880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442019955880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},
{"timestamp":1442020255880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442020555880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},
{"timestamp":1442020855880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},
{"timestamp":1442021155880,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1}]}]}}

 

Using JSON on Windows (curl for Windows has been installed before hand); note that to account for special characters the data

 
{
  "username":"auser",
  "password":"apassword",
  "startTimeExp":"1-hours-ago",
  "endTimeExp":"now",
  "searchCriterias": [
    {
      "searchOption": "TEST_SERIAL_NUMBER",
      "searchTerms": "990219"
    }
  ]
}

needed to be in a file (c:\post.txt in the example below). The command used is

 

C:\Users\piyush.mehta>curl -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @c:\post.txt http://kaseyasupport.kaseyacloud.com/api
/json/test/getRawHistoricalData

with the results

 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: TraverseJSessionID=28E29484E48894C30087191BE3E85849; Path=/; HttpOnly
Date: Sat, 12 Sep 2015 01:34:15 GMT
Content-Type: application/json
Content-Length: 2250

{"success":true,"errorCode":null,"errorMessage":null,"timestamp":1442021655381,"timestampStr":"Friday, 11 September 2015 18:34:15 o'clock PDT","result":{"histor
icalData":[{"testSerialNumber":990219,"deviceSerialNumber":990193,"accountSerialNumber":49,"testName":"Round Trip Time","deviceName":"DGE01","accountName":"Core
 Infrastructure","units":"ms","thresholdType":1,"percentile95":1.0,"percentile98":1.0,"minValue":1.0,"maxValue":1.0,"stdDev":0.0,"mean":1.0,"values":[{"timestam
p":1442018215881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":144201851
5881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442018815881,"minVal
ue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442019115881,"minValue":1,"avera
ge":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":1442019415881,"minValue":1,"average":1,"maxVa
lue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442019715881,"minValue":1,"average":1,"maxValue":1,"warn
ingThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442020015881,"minValue":1,"average":1,"maxValue":1,"warningThreshold
":250,"criticalThreshold":1500,"maxSeverity":2048,"numSamples":1},{"timestamp":1442020315881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criti
calThreshold":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442020615881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold
":1500,"maxSeverity":2048,"numSamples":2},{"timestamp":1442020915881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxS
everity":2048,"numSamples":1},{"timestamp":1442021215881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":204
8,"numSamples":2},{"timestamp":1442021515881,"minValue":1,"average":1,"maxValue":1,"warningThreshold":250,"criticalThreshold":1500,"maxSeverity":2048,"numSample
s":1}]}]}}

{  "success": true,  "errorCode": null,  "errorMessage": null,  "timestamp": 1442021238429,  "timestampStr": "Friday, 11 September 2015 18:27:18 o'clock PDT",  "result": {    "historicalData": [      {        "testSerialNumber": 990219,        "deviceSerialNumber": 990193,        "accountSerialNumber": 49,        "testName": "Round Trip Time",        "deviceName": "DGE01",        "accountName": "Core Infrastructure",        "units": "ms",        "thresholdType": 1,        "percentile95": 1.0,        "percentile98": 1.0,        "minValue": 1.0,        "maxValue": 1.0,        "stdDev": 0.0,        "mean": 1.0,        "values": [          {            "timestamp": 1442017855880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442018155880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 1          },          {            "timestamp": 1442018455880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442018755880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442019055880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 1          },          {            "timestamp": 1442019355880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442019655880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442019955880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 1          },          {            "timestamp": 1442020255880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442020555880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 2          },          {            "timestamp": 1442020855880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 1          },          {            "timestamp": 1442021155880,            "minValue": 1,            "average": 1,            "maxValue": 1,            "warningThreshold": 250,            "criticalThreshold": 1500,            "maxSeverity": 2048,            "numSamples": 1          }        ]      }    ]  }}

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

0 Comments

Article is closed for comments.