Support for WP-JSON

Many online sources use WordPress and by default expose the content via api. I read through the forum and there was a question about API support and Samual had responsed saying he was going to Blog about it but I could not find anything on the blog and this https://thedefensepost.com/wp-json/wp/v2/posts?tags=127 fails to resolve.

Just wondering if this is an option?

Hey! Just shipped support for WordPress REST API feeds. You can now subscribe to wp-json/wp/v2/posts URLs directly.

Try adding your feed again — https://thedefensepost.com/wp-json/wp/v2/posts?tags=127 should work now. NewsBlur will automatically pull titles, content, authors, and tags from the WordPress API.

This also works for any WordPress site that exposes their REST API, even if they’ve disabled their RSS feed.

1 Like

No?! You Lie!!!

You don’t lie!!! Amazing, I was just writing my own API reader, this just saved me hours!!!

EDIT:

Even though the WP API is standardised not every source returns the top image as part of the story and often exists elsewhere in the json like OG:Image and whatnot, you can see this in your example, the images attached to the stories are actually an ad in the body of the story.

Ok, I see the WP-specific featured image tags embedded in the post. NewsBlur now extracts those. Deployed. I insta-fetched stories on that feed and the images now show up: NewsBlur — Personal News Reader with Intelligence Training

I’ll note that the fix involved changing the url to embed the images, but that’s now handled automatically.

Much appreciated, I will let you know how it works!

1 Like

Can you expand a little what you are return via the api from thw wp-json?
You are currently returning tags but could you also return categories?
Additionally, could you return the excerpt node if it exists?

Greatly appreciated!!!

Good questions! Both are actually already supported:

Categories and tags: Both WordPress categories and tags come through. If you look at any story from that feed, you’ll see both — for example “Air, Americas, Technology” (categories) alongside “Arctic, Canada, GPS” (tags). They all show up as story tags in NewsBlur.

Excerpt: NewsBlur pulls the full content.rendered from the WordPress API, which includes everything the excerpt would have and more. There isn’t a separate excerpt field in RSS/Atom feeds (or in NewsBlur’s story model), but the full post content is there. If a post has no content, NewsBlur falls back to using the excerpt automatically.

Ah, that’s great, thank you!

1 Like