Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?
share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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:

  • metaWeblog.getPost - for retrieving a single post based on its ID.
  • metaWeblog.getRecentPosts - for retrieving a list of recently published posts

You can also create/edit posts with these API calls:

  • metaWeblog.newPost - create a new post
  • metaWeblog.editPost - edit an existing post

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.