Getting http response to notification service output

my host.conf looks like below

object Host “ASO-E-64” {
import “generic-host”
address = “10.34.187.17”

vars.notification[“mail”] = {
users = [ “myuser” ]
}
vars.http_vhosts[“My Host”] = {
http_uri = “/api/v1/check”
http_ssl = true
http_expect_body_regex = “(state” : “UP)”
notification_serviceoutput=?(want the response of /api/v1/check here)
}

}

I want to assign the api response to notification_serviceoutput so I can see the response on my email notification. Any help appreciated

lets assume you use check_http:
check http has a printing option.
if you print the response to command output you can later have the response in in your notification

-B, --show-body
    Print body content below status line

My service.conf file looks like below:
How do I provide that arguement

apply Service for (http_vhost => config in host.vars.http_vhosts) {
import “generic-service”

check_command = “http”

vars += config
}

first you need to extend the http command because it’s missing the -B --show-body option:

object CheckCommand "my_http" {
    import "http"
    timeout = 1m
    arguments += {
        "--show-body" = {
            description = "Print body content below status line"
            set_if = "$http_showbody$"
        }
}

after that you can set it in a service that imports my_http