Construct your own WordPress API endpoints!
This workhorse is simply unbeatable when it comes to building your custom WordPress API.
Download now and convert your WordPress into an API machine.
This comprehensive add-on is loaded with all features you would ever need to manage your own API. Endless possibilities at your fingertips:
Customize API URLs
http://mywordpress.com/api-endpoint/tld - change
tld in the plugin settings screen:
Minimal capability permission per API endpoint
The built-in WordPress roles/capabilities system is used. If you wish to restrict access to the API, you would usually do this:
- Optionally, use user role editor WordPress plugin to create a special role/capability, for example ""
- Create a separate WordPress user to access API (if you are the only consumer of your own API), or assign api capability to the users you want to grant API access to
- Enter the capability for your endpoint (see screenshot above).
Customize HTTP headers
By default, a few HTTP headers are set for you by default. This means that they will be always sent with every API response, unless you override them:
Cache-Control: no-cache, no-store, must-revalidate
The first header allows your API to be called with using Ajax from domains other than your WordPress site's one. The other ones prevent API responses from being cached by the caller.
Good news is that you can easily add more or override existing HTTP Headers:
In this example we add a header that tells the API caller that the output is in JSON format.
Return any data from your WordPress site
Yes, in your API endpoints you can return pretty anything: posts/pages, custom posts, comments, settings, users, site options, post metadata, users, drafts, activity and much more.
This is possible because Twig Anything can read from the MySQL database of your WordPress. This simply means that you can query any information from your site and output it in you API.
Turn any local file into an API (CSV, JSON, XML, you name it)
Because Twig Anything can read from many various sources and understand a lot of different formats, you can turn all this data into API!
JSON, XML and MySQL is understood out of the box.
And there is a number of free add-ons that add even more sources to fetch data from and turn it into API: local and remote databases, CSV.
Fetch any data from 3rd party APIs and turn into your own API
Twig Anything can do that as well - and you can turn any Twig Template into an API Endpoint.
Boost API speed with the caching system out of the box
API Endpoints naturally benefit from the intelligent caching system of Twig Anything. Read more in topic How cache works.
Output API in any format, including, but not limited to, JSON, XML, RSS/ATOM, YAML and HTML.
You have full control of what API returns through Twig Templates.
For instance, this template:
... makes up a JSON response:
Control success/error templates
In the settings screen, setup your desired templates for both successful responses and failures. You get some good JSON defaults for you out of the box, but feel free to change to any other format, i.e. XML, YAML etc. :
P.S. An example of a failure is an authentication error:
Intelligent template editor with code highlighting and full screen mode
It is very capable! Still not convinced? Give it a try by downloading now and tell us what you think.