func (api *API) ApplicationGetByHostIdAndName(hostId, name string) (*Application, error) {
	var res *Application
	apps, err := api.ApplicationsGet(Params{"hostids": hostId, "filter": map[string]string{"name": name}})
	if err != nil {
		return nil, err
	}
	if len(apps) == 1 {
		res = &apps[0]
	} else {
		e := ExpectedOneResult(len(apps))
		err = &e
		return nil, err
	}
	return res, nil
}
Gets application by host Id and name only if there is exactly 1 matching application.
package zabbix
import (
	reflector "github.com/devopyio/zabbix-alertmanager/zabbixprovisioner/zabbixutil"
)
type Application struct {
	ApplicationId string `json:"applicationid,omitempty"`
	HostId        string `json:"hostid"`
	Name          string `json:"name"`
	TemplateId    string `json:"templateid,omitempty"`
}
type Applications []Application
func (api *API) ApplicationsGet(params Params) (Applications, error) {
	var res Applications
	if _, present := params["output"]; !present {
		params["output"] = "extend"
	}
	response, err := api.CallWithError("application.get", params)
	if err != nil {
		return nil, err
	}
	reflector.MapsToStructs2(response.Result.([]interface{}), &res, reflector.Strconv, "json")
	return res, nil
}
func (api *API) ApplicationGetById(id string) (*Application, error) {
	var res *Application
	apps, err := api.ApplicationsGet(Params{"applicationids": id})
	if err != nil {
		return nil, err
	}
	if len(apps) == 1 {
		res = &apps[0]
	} else {
		e := ExpectedOneResult(len(apps))
		err = &e
		return nil, err
	}
	return res, nil
}