I was wondering how does external app works for wordpress.com
or wordpress.org
.
Directly connecting to the wordpress database seems a bad idea to me.
Questions
- How can I create an app or get / post data from the wordpress database?
- Is there a JSON API or XML API format so that I can easily exchange data between the two?
WordPress features a very rich XML-RPC interface that you can work with from external applications. It provides you access to most of the functionality you’d have directly in the admin – write posts, edit posts, edit comments, create/edit categories, manage site options, upload files, etc.
As a matter of fact, certain third-party applications are already using this functionality to allow you to manage WordPress remotely – a good example is Windows Live Writer. It works for both self-hosted (.org) sites and sites hosted on WordPress.com.
So if you need to get posts from WordPress, I’d recommend following API calls:
You can also create/edit posts with these API calls:
There’s more information about creating your own application (and an explanation as to why WordPress supports third-party APIs like metaWeblog) in the Codex.
I’ve also written tutorials on how to use the API and documentation specific to making/parsing metaWeblog API requests.
For self-hosted WordPress blogs, you can use the JSON API plugin. I’m working with it on a project right now… it’s fairly full-featured OOB, and it’s extensible. Documentation is here.
Not sure about wordpress.com blogs.