RESTful Web Services in a WordPress Plugin? | MikeSchinkel.com
http://mikeschinkel.com/blog/restful-web-services-in-wordpress-plugin/
Here’s the details. I started writing a plug-in called “RESTful Services” with a goal of implementing URLs that behave in the following fashion; {format} could potentially be html, xhtml, json, xml, rss, atom, etc.:
http://example.com/services.{format} Provide a list of RESTful services in specified {format}, defaults to html http://example.com/services/{service}.{format}/{data}?{params} Provide a RESTful service in specified {format}, defaults to html, with optional provided data and parameters. But before I got all those options working I just wanted to service a page from my RESTful Services plugin where Content-Type: text/plain. I found this page that professes to explain how to hook into the URL routing and after a few fits and starts I can came up with the following code for my plugin that would indeed response to my http://example.com/services URL: