1

I'm currently working on application where I want to use data from my blog which is hosted on digital ocean. I have installed wordpress for the blog on the server with domain name abc.com. I have to call wordpress rest api to get data without authentication if possible or using application client secret key. How we can do that?.

While calling like this "https://public-api.wordpress.com/rest/v1.1/sites/abc.com/posts/?pretty=true"

this return

{
"error": "unknown_blog",
"message": "Unknown blog"
}
baldraider
  • 1,049
  • 2
  • 18
  • 48

2 Answers2

2

do you mean

abc.com/wp-json/wp/v2/posts

url like this will get the all posts title content, and if you want to get single post, you can do

abc.com/wp-json/wp/v2/posts/1

1 is post_id , you can replace with other post id

Xiao Xinqi
  • 511
  • 3
  • 8
  • 19
0

Below function is useful for register endpoint for creating API from function.php file. Refer below link for further deployment.

    register_rest_route

https://developer.wordpress.org/reference/functions/register_rest_route/

Below link is very helpful for create API in WP environment.

http://v2.wp-api.org/

You can get overview from below word press popular plugin as well, but in latest word press there is no need to use this plugin as default word press provide almost all functionalities.

WP REST API (WP API)

Ashish Patel
  • 3,551
  • 1
  • 15
  • 31