[Blogs Connector] Wordpress Api Base URL

Forge Component
(0)
Published on 2018-12-02 by Nuno Reis
0 votes
Published on 2018-12-02 by Nuno Reis

I tried my blog URL to get,

But it always shows 404 not found. 

Is there any specific way to find the URL of my wordpress?

What version is your WP? It only works in 4.7 and above.

I did it based in the documentation at http://v2.wp-api.org/ and it worked for 90% of the blogs I tested.

Can you share the blog URL?

Nuno Reis wrote:

What version is your WP? It only works in 4.7 and above.

I did it based in the documentation at http://v2.wp-api.org/ and it worked for 90% of the blogs I tested.

Can you share the blog URL?

Blog URL : https://sportsmadeeasy.blog

Above is my blog page URL and how to get blog posts from this?


Apparently while self-hosted blogs are

https://blog.nunoreis.pt/wp-json/wp/v2/

for blogs hosted at wordpress.com the URL is:

https://public-api.wordpress.com//wp/v2/sites/sportsmadeeasy.blog/

Similar to what Blogger has.

It can be done at the root.



You need to make a minor adjustment on each method for it to work and change to this format

https://public-api.wordpress.com/wp/v2/sites/sportsmadeeasy.blog/posts?

It means going on each of the methods and delete the start of the URL

Tomorrow I'll publish a fixed version that will guess if it is a wordpress.com or a wordpress.org.


Hi Keerthi.

It is now working. I published a new version and tested with several blogs wodpess.com including yours. There was a minor bug in the GetPages that prevented the correct usage in Example so I made a 2.0.1 version to fix it.

Thanks Nuno,


Will look at it and let you know : )

Nuno Reis wrote:

Hi Keerthi.

It is now working. I published a new version and tested with several blogs wodpess.com including yours. There was a minor bug in the GetPages that prevented the correct usage in Example so I made a 2.0.1 version to fix it.

Hi Nuno,

              It is working fine. But I couldn't get image of the blog and featured image from the response. How can I get the image of the blog from this? 

Thanks in advance.



My goal with this component was to save the texts.
Images usually are stored locally by the user, but everyone forgets the text.

Each post has an id in featured_media field. You can get the full link in links->wp_featuredmedia, but it simply points to a new method where you can get the image path. That one is not implemented here.