I have various sections on my website, such as a blog, forum, wiki etc and I’d like to develop an API to encompass all these sections, and allow users to pull information from any section.
Users should also be able to pull information (such as latest posts) from multiple sections at once and return the results. The API should be very modular, so as to allow new sections to be added easily if, for example, another blog is added.
I’m just looking for a point in the right direction for developing something like this.
Thanks.
For content sites, an actual API is rarely necessary, unless you want to allow users and clients to post to your site.
What you actually need to do is just to separate logic from presentation.
Per example:
Of course, this is a very basic example. But once you’ve separated your presentation from your logic, you can easily create templates in a multitude of different formats, which can be parsed using different tools (JSON encoder, XML parser, etc.) by different clients (mobile application, aggregator service, third-party application, etc.).