Go to All Forums

Parse JSON response in REST monitor

I would like to check the "grade" my site has been assigned by SSL Labs to be sure it's not failing. (Norton uses this to decide if they should block a website, and mine was recently blocked)

The REST API URL and JSON response are at the bottom of this post.

What I need to identify is whether I have an "A" or "B" grade versus a "C", "D" or "F" grade.

Using the TEXT parser, I can't include quotes, so searching for "A" really isn't allowed.  And if I just search for the letter A, that occurs everywhere. 

For JSON I tried both ['endpoints'][1]['grade'] and I tried endpoints[1].grade. Neither worked.

I've never really got RegEx down, so if that's the only option, I'd really appreciate a specific search string to use.

Suggestions?

Thanks,

Pete


https://api.ssllabs.com/api/v2/analyze?host=www.governmenttools.com&fromCache=true

The JSON response is this:

{
  "host": "www.governmenttools.com",
  "port": 443,
  "protocol": "HTTP",
  "isPublic": false,
  "status": "READY",
  "startTime": 1468620780267,
  "testTime": 1468620827254,
  "engineVersion": "1.23.46",
  "criteriaVersion": "2009l",
  "endpoints": [
    {
      "ipAddress": "199.45.236.51",
      "serverName": "sta-199-45-236-51.rockynet.com",
      "statusMessage": "Ready",
      "grade": "B",
      "gradeTrustIgnored": "B",
      "hasWarnings": false,
      "isExceptional": false,
      "progress": 100,
      "duration": 46670,
      "eta": 1,
      "delegation": 2
    }
  ]
}

Like (1) Reply
Replies (3)

Hi, 

Right now, the JSON validation is not supported for multiple levels. But, you can use the RegEx to find whether your website has "A", "B" or other grades in the response. 

Please edit the REST API monitor and select the "Response Type" as "Text" from the drop down list. Then update the keyword as follows "grade": "(A|B)" in the RegEx filed (Match the given regular expression in the response) and update it.  This will help to trigger alerts if the response has the grade other than A and B.

Regards, 
Rafee


Like (0) Reply

Are there plans to make JSON path and value validation work in future? How do you account for a JSON path that may have multiple of same attribute and need to narrow down to the actual path?

Like (0) Reply

We now support JsonPath and XPath expressions in the REST API Monitor. You can enter a path expression that contains your required conditions for a successful response. If the expression returns one or more results, the content check succeeds.

Like (0) Reply

Was this post helpful?