Home > Net >  Is WordPress's API not accessible for free accounts?
Is WordPress's API not accessible for free accounts?

Time:05-12

I signed up for a free WordPress account with the intent of integrating their blogging capabilities as a 'feature' into my React-based app. However, after signing up for the WP account and creating a few blog posts, I attempted to acccess the API by appending "/wp-json" to my WP account, as per the official documentation.

Everytime I use this method to access, however, all I get is a 404 error. I've seen elsewhere on Stack Overflow that this might have to do with Permalinks not being set properly. However, Permalinks cannot be altered in 'free' accounts, only in 'Pro' accounts. I therefore suspect that WP has disabled the API capabilities for the free accounts. I can understand why they would do this, since they want to get people pay to use their platform (and not get everything for free via an API). Am I correct in this?

Or can anyone who has a free account who has access to the API correct me here?

Thanks in advance,

CodePudding user response:

On the WordPress.com platform the REST API is actually hosted and structured at https://public-api.wordpress.com/wp/v2 for all sites. In addition, there's a /sites/ endpoint that will namespace your specific site.

For example, the root endpoint for your site would be https://public-api.wordpress.com/wp/v2/sites/dsgasdgfsa.wordpress.com/. The other endpoints behave the same way as they would on a self hosted platform.

For example, your pages would be found under https://public-api.wordpress.com/wp/v2/sites/dsgasdgfsa.wordpress.com/pages

More info https://developer.wordpress.com/2016/11/11/wordpress-rest-api-on-wordpress-com/

  • Related