json Web Service in module
Posted: Tue Jul 26, 2011 4:43 pm
Hello,
I would like to include a json api within my module and was wondering if anybody has ever done this before. Basically I would like to create an easy way for others to include content from my module on their website using a json feed generated by module.
I was planning on creating a new file within my module that would look something like this - action.jsonfeed.php. This file would perform various queries based on URL parameters and then output the result as a json string. I feel pretty comfortable with this process.
What I'm struggling with is how to create a pretty URL that would call the "action.jsonfeed.php" file directly and be accessible to anyone who wanted to use it. I've thought about creating a page within CMSMS and within that page including a tag like {MyModule action="jsonfeed"}. The page template would be blank and only contain a {content} block but this seems a little messy to me.
Does anyone have any ideas for a better way to achieve this?
Thanks,
Ben
I would like to include a json api within my module and was wondering if anybody has ever done this before. Basically I would like to create an easy way for others to include content from my module on their website using a json feed generated by module.
I was planning on creating a new file within my module that would look something like this - action.jsonfeed.php. This file would perform various queries based on URL parameters and then output the result as a json string. I feel pretty comfortable with this process.
What I'm struggling with is how to create a pretty URL that would call the "action.jsonfeed.php" file directly and be accessible to anyone who wanted to use it. I've thought about creating a page within CMSMS and within that page including a tag like {MyModule action="jsonfeed"}. The page template would be blank and only contain a {content} block but this seems a little messy to me.
Does anyone have any ideas for a better way to achieve this?
Thanks,
Ben