I'd like to setup Magento so that if I make a request with an URL such as: http://mymagento.com/api/storeconfig (actual url format not important)
would return json with the data requested. How can I achieve this? Here's how I'm retrieving the data:
public function getStoreSettings()
{
//this successfully retrieves the value of my custom settings property
$my_property= Mage::getStoreConfig('my_module/my_settings/my_property', 'default');
$data = array('my_property'=>$my_property);
$json = Mage::helper('core')->jsonEncode($data);
//return json here
}
Where would the right place to add this code? How can I map an URL to call this function and return the response as json? I appreciate if anyone could point me in the right direction!