I would like to add a monitor to detect unhealthy service and sending alert in that case.
I've expose a simple REST API - /healthy
which returns a JSON
e.g. {"healthy": true}
.
Then I've added a REST API Monitor
to my site24x7 account, set the content checks response format to JSON and now I should provide a JSONPath to be asserted.
In a JSONPath online tester when I use $.healthy
I get [true]
.
But I guess I should try to assert that return value.
Using following expressions didn't worked
$.(@healthy=='true')
$.[?(@.healthy=='true')]
$[?(@.healthy=='true')]
$?(.healthy=='true')
$.healthy=='[true]'
$.healthy==[true]
$.healthy==['true']
Thought I should evaluate the assertion expression using ()
or filtering.
How I can assert the return healthy status?
In site24x7 example I see an example for JSONPath expression
$..[?(@.overallStatus=='true')]
which i couldn't make it work in my case
Thank you