A plugin for supporting WP using the REST API
I got tired of asking if someone installed new plugins and all the other normal questions I initially ask when some says “My site is broken”. So I wrote a plugin to tell me these things.
The GitHub page is here: http://antonioortegajr.github.io/wp-sys-profile/
In this project I found similar plugins and a service that display system information. I had no idea they existed, but not surprised. However I really wanted a REST endpoint. I am able to automate the checks of the sites I host. Or if I choose to take on a new site for installing the plugin answer a lot of the question I would normally ask like “what plugins are installed?” and “what version of php are you on?”.
I was a little worried about any of the data being “sensitive”, so a public and private endpoint was added. The plugin will generate an API for the private endpoint. I wondered about security already in this post: http://antonioortegajr.com/new-wordpress-api-make-wp-installs-data-suppliers/ and now that I had a project using the WP REST API I am less worried. I generate an API key and while that isn’t as secure as say OAuth it’s a lot easier for my friends to create a key and chat it at me so I can get the info.Most of them can install a plugin on their own, but might get a little confused by having a service authenticate them. Additionally revoking and creating a new key is just a single click. I wanted this to very simple for the user. So I settled on an API key.
Some of the things I learned in this project are:
- I really just like APIs
- If there is something pre existing people will ask “why do it at all?”
- WordPress now is a marketing site and a public API even in one click installs
That last one really sticks out to me. For anyone needing both a marketing site and an API (like to power a mobile app) WP is now a one click solution. IF you need an API, using an API frame work like Django for Python or LoopBack for node is probably better. However using WP means less maintenance and it’s in PHP just like WP. You could use Lumen is in PHP so that would eliminate the multi-lingual need, but I can understand the appeal everything in one language and in one place with one click to get started. Even if I disagree. Which I do.
WordPress has done so much to bring people into the world of websites and allowed for theme and plugin developers to empower anyone to DYI when they might not have the resources to pay a dev to build custom code for them. WordPress make it easy for anyone to get a site up in 5 min. Buy hosting and a theme and add words. This led to a huge market share and a large amount of poorly crafted and poorly maintained websites. Now we have the same opportunity with APIs. I actually find that a little worrisome, but excited for APIs to be the next must have for online presence.