WordPress.com API

Did you know there is an API for not only WordPress but WordPress.com? I guess they are fairly similar except one is used for self-hosted WordPress blogs while the other is used for the blogs hosted by WordPress.com.

Recently, I have migrated of self-hosted WordPress and into using WordPress.com as a host provider. Previously I used Corcel to gain access to the WordPress backend. It worked great. I just needed to display recent blog entries on non-WordPress sites. You just needed access to the database. Well, you don’t have this access when hosted by WordPress.com. I spoke to their support and they suggested to pull the site’s RSS feed and style it with CSS. Then I remembered there was a WordPress REST API.

I started looking into it and decided this was a better solution. Then I found out that WordPress.com has its own API. I played around with it and updated my site to use this instead of Corcel. There many things you can do without an account or API key. Just go to their website and enter a few parameters and it will generate a URL that will display the results in JSON. The URL starts with https://public-api.wordpress.com/ – then you add the URL that’s generated from their console API console.

Let’s take their very own blog found at en.blog.wordpress.com. Now visit https://public-api.wordpress.com/rest/v1.1/sites/en.blog.wordpress.com/posts/?fields=…. Cool huh?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s