5

I see WordPress.com recently started using Gutenberg, which relies on the WP REST API. I'm building a plugin and I'd like to use the WP REST API from a self-hosted site, and have it communicate with a WordPress.com site, but I'm having trouble finding the REST API base URL. For example, https://cmljnelson.wordpress.com/wp-json is a 404. The documentation about REST API discovery doesn't seem to apply to WordPress.com. How can I find the WP REST API base URL for WordPress.com sites?

2 Answers 2

7

WordPress.com's REST API apparently is shared among sites hosted there and you can access it here: https://public-api.wordpress.com/wp/v2/.

If you want access to the REST routes of a specific site in WordPress.com, use the /sites route:

https://public-api.wordpress.com/wp/v2/sites/{site-id or domain name}/

eg. https://public-api.wordpress.com/wp/v2/sites/cmljnelson.wordpress.com

WordPress.com REST API

Further reading:

Sign up to request clarification or add additional context in comments.

2 Comments

What is this {site-id or domain}? It gives me Unknown blog for my domain.
I've been looking for this answer for hours and I only see folks answering "it's enabled by default" when its not. (its enabled by default, yes, on localhost / self hosted project. Not on WordPress.com. There is no such thing like Settings > Permalink to make the wp-json path available)
0

For me using /wp-json/wp/v2/ at the end of the URL worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.