Is there a wordpress plugin to create an API from your site?

I would like to use data from my wordpress site in the form of an API. Maybe REST with JSON output. I am wondering if there are any plugins that automatically make Wordpress data accessible from outside the site it runs on, similar to the way most web APIs work.

+4
source share
5 answers

WordPress is basically a platform with a REST platform. You enter a URL with a specific query string (sometimes buried in "fairly constant"), and the system returns a semi-static resource based on the layout and structure defined in your topic.

To create it in the "API", you first need to determine what information you return and how you want to structure it. Do you want people to access your data through a typical link ( http: //blog.url/? Post = xxx & category = xxx & whatever = xxx )? Or do you want to keep a regular blog, but allow API access through another mechanism?

If you want a second route, you can always connect the plugin to the built-in XMLRPC WordPress service. Then users will make a request of something like http: //blog.url/xmlrpc.php? Resource = xxx & variable = yyy & somethingelse = zzz , and your site will return any necessary information (although this will be SOAP, not REST ... so this really up to you).

See my answer here for a specific example with WordPress code ...

+4
source

I used this REST / JSON API with some success, so without creating an API, could you split it up and change it to your needs? This plugin seems to support only output, not input (comments, etc.). It also seems that there is a discussion about creating similar api firmware for entry and exit, and this may also be one way. Enjoy!

+2
source

Yes, there is a way, and I just found it!

You can go here: http://developer.wordpress.com/docs/api/

all you have to do is fill in your website as a request:

https://public-api.wordpress.com/rest/v1/sites/$yourSiteHere/posts/

and you will get beautiful JSON.

You can leave comments, receive data and add requests quite easily.

If you want to do more that requires a login, you can use oAuth.

+1
source

Endpoints API The wordpress plugin allows you to create any API from your WordPress site.

0
source

If you are a Wordpress plugin developer and need a RESTFul API, perhaps therma-api.com can help you: A Wordpress plugin for connecting to a REST API?

But I think the best way is to use the WP-REST-API: http://v2.wp-api.org/extending/adding/

0
source

Source: https://habr.com/ru/post/1308571/


All Articles