Reputation: 4664
I'm trying to write a plugin that would add these endpoints GET, POST, DELETE /api/checked
to access the plugin's custom table.
Is it possible for a Wordpress plugin to expose a RESTful API? I can't seem to find any examples or documentation.
The closest thing I found was add_rewrite_rule
. I was able to create http://www.blog.com/api
, but how do I determine the HTTP verb?
Upvotes: 2
Views: 2095
Reputation: 1757
You can use WP REST API. Just install it and then go to settings -> permalink and add /%postname%/ on the last field.
then you'll have everything you need at [url]/json-api/
Here is the doc
Upvotes: 1
Reputation: 1613
You can use JSON-API
WordPress plugin for creating the web-services that can be used for fetching the data from Wordpress.
And the plugin will provide the webservice url something like that :
www.mysite.com/api/servicename
Plugin link : https://wordpress.org/plugins/json-api/
Hope it helps you some extent.
Upvotes: 0