Use puppetdb v2 api to fetch facts and avoid using a cache
Create a proper JSON reply for reverse lookup as well