Heartbeat issue when matching on response body string negatively

Hi all,
I am setting up a heartbeat monitor (version 7.5.0) for an API whose response can be of the following types

#response is okay, API can be considered up
{
    "usersList": [
        {
            "firstName": "Lorem",
            "lastName": "Ipsum",
            "email": "lorem.ipsum@abc.com",
            "userId": "3399b012-d312-441c-9d3f-0b5e5ef4c132"
        },
        {
            "firstName": "LoremOne",
            "lastName": "IpsumOne",
            "email": "loremOne.ipsum@abc.com",
            "userId": "2ee9f020-dec1-4e5f-8d57-a85073b30730"
        }
    ]
}

or

#response is not okay, API should be considered in down state. 'xyz' can be any word 
{"error":"xyz not found in our database"}

In case of error response as above, the monitor should change its status to down. For this I have written the yaml file as follows:

- type: http
  id: RESTAPI test
  name: Demo Service
  schedule: '@every 5m'
  #path of the url specified below
  urls: ["http://localhost:8080/api/endpoint"]
  check.request:
    method: GET
  check.response:
    status: 200
    body:
      negative:
        - 'not found in our database'

, if the phrase 'not found in our database' is present in the response body string, then it should return match failed and the status should change to down. But it is not being detected. Please let me know where I am going wrong

Hi @Nipun1, your configuration looks fine and should work, however, the negative check was only added in 7.11 (PR), so you will need a newer version than the 7.5.0 you are currently using.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.