[The Hub] REST API for Hub

Consider a web service API for the Hub to view activity and control sites without going to the WPMU DEV website.

This was prompted by another request by @mohammadqureshi for a mobile app for the Hub.
https://premium.wpmudev.org/forums/topic/new-product-mobile-app
While I disagree with that dedicated effort, I am making this alternative proposal that I believe might satisfy the same ultimate desire.

If Dev publishes end-points for WP API calls for non-UI functionality, then we in the field can create our own mobile functionality via web services and common consumer tools.

I actually do not feel strongly about this. No new development requested unless it's minimal. I still prefer limited resources to be dedicated to other more important requests here. But this feature could have marketing value. It might also be accomplished with much less coding effort than a dedicated effort for better UX for the Hub 2.x+ browser UI. With a web service interface to the Hub, multiple UI's can be created in the field, so we all get multiple new and creative approaches to UI solutions with a single effort from WPMU DEV. Win-Win.

End-point examples:
- Activate site feature with Put /Automate/On/foo.com
- Deactivate with Put /Reports/Off/bar.com
- Post /Security/RunScan/foo.com/
- Post /Security/Blacklist/Activate/foo.com
- Post /Performance/Email/Off
- Post /Automate/Plugin/Off/foo.com/ultimate_branding
- Get /Uptime/ResponseTime/20180101/20180103 (array of timestamps and responsetime in ms).
- Get /Uptime/Downtime/20180101/20180130 (array of events with FromTime,ToTime,seconds)
- Remove contact from the list of people getting a report:
Put /Reports/foo.com/MyReportName/Recipient/aaa@foo.com

How might reporting be used? Consider a custom app, server-based or mobile, that checks to see if there is a new Uptime event. With that information the client-side code may post a Slack update, send SMS, put the server into maintenance mode via the WP CLI, or even restart the webserver or network. We have no idea what kind of applications someone could create with ready access to information like that.

How might instructions To the Hub be used? Let's say you're reading an article that says PowerPluginX now has a virus. With a single web service call you might be able to de-activate that plugin for all of your sites:
Post /Plugins/powerpluginx/Off/AllSites
Sure, we can do that one function with the WP CLI but we'd need client side code that does this for all of our sites. The Hub already has access to all sites for this kind of operation.

As a final example, what if we're going to do some work on a site when we get home and we want to get a backup while we're on the way? Open a custom app and execute a function that goes to:
Post /Backups/Run/foo.com
When was the last backup?
Get /Backups/Last/foo.com

In summary, the raison d'être of the Hub is to centralize site management. The initial approach to that is facilitate site management via the browser. In that process Dev has created a lot of rules in the server which implement directives from the browser, and rules which return data to be formatted for the browser. This proposal is a continuation of that core purpose, with modularization of those rules over time so that they can be accessed via the WP API, thus allowing for alternative User interfaces and for new system interfaces that rely on the Hub for functionality, not aesthetics.

  • James Farmer

    Very interesting, and something I think that would be well worth considering down the line, but right now pretty much the whole direction of the business is about USING The Hub (and making it stupendously better) rather than not, lol.

    It reminds me a bit of my https://premium.wpmudev.org/blog/introducing-blogsmu/ project back in the day... it still seems to make sense (a wordpress.com for wordpress.coms, a bit like how this would be a wpmu dev for wpmu devs) although obviously APIs and services are very different beasts.

    I wonder if this is more an enterprise application?

    I'm sure Aaron would have some thoughts on it from a CTO perspective, but from a business perspective I think you're about 3 years ahead of us lol.

    • Tony G

      Thanks, James. I agree that this is a down-the-line thing given everything you've shared with us in these forums.

      I think a lot of the structure and code is already in place. Many API endpoints are already defined, just not documented.

      I have no idea what the effort would be to expose and document more of the Hub features. That evaluation might help to determine if perhaps a passive effort could be made in this area to API-enable features over time, or if that effort requires a dedicated task of its own. In other words, if the effort is minimal, then perhaps we could see an occasional point-release that includes a note about a new documented endpoint. Maybe just an occasional blog about what's already there would provide some near-term fodder to see what people can and will do with this.

      I think the Hub is a good service at the right time. There is enough chatter in the WP world about site management to warrant it. I think it deserves more marketing, but that needs to be balanced with getting it into that v2+ level of quality. An API and new third-party tools (Git projects, plugins, apps, etc) evolving into an ecosystem could play a part in such marketing, to appeal to new potential members with larger numbers of sites to manage.

      It would be an interesting statistic to know the current highest number of sites supported in the Hub by a single member account, and the average sites per account. That would be "where are we now" data. Then compare that to researched numbers for companies that manage large numbers of sites, and possibly looking for better ways to do so. That would be "what's our potential" data. I think that those numbers can serve as metrics for deciding whether there is enough demand for an enterprise app = API effort as you suggest. Then of course come the questions about how to attract those prospects, the cost of that effort, weighing with current priorities, etc. But less grandiose than a big effort, I'm curious if creating and documenting new endpoints occasionally really takes much effort.

      This whole concept also relies on third-parties to step up to build around the offering. That's another marketing effort which you know I've been trying to steward - but we're not there yet, so is an API chicken or egg? I dunno.

      Interesting about BlogsMU ... I signed up here just after that effort, never knew about it. I've been trying to kick off a service "peripherally similar" to that for a long time using Dev tools ... if only there were enough time for that amongst everything else.

      Best.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.