wordpress api console

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?


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.