Hi all,
I need to create some webservices that will be called by either ajax calls from within our site or API calls coming from another server, and will reply with a JSON.
Is there an established best practice?
Digging in the code i found two different ways to do that:
if( $this->_getParam('sendNow', true) )
{
return $this->_helper->json($data);
else
{
$this->_helper->viewRenderer->setNoRender(true);
$data = Zend_Json::encode($data);
$this->getResponse()->setBody($data);
}
Rather than delete your post, I edited and put the code in the required code tags as our forum rules say. Please remember to use the code tags. I don't have an answer to your question though.
odd - I did put the code tags...
Well that's weird. Are you sure you clicked the code icon and used the popup? That's the only way they work.
https://www.socialengine.com/marketplace/search?search=api there are a few API plugins. Would it be faster for you to use one of those or perhaps even use one of them as a guide to creating your own?
yeah I do need to create my own