Creating external apps WordPress / How they work

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.

Read More

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?

Related posts

Leave a Reply

2 comments

  1. 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.