I had high hopes for the REST API for Pro reports…
I’m really disappointed by what was released. I will try to stay constructive here and propose a v2 that is built from scratch… correctly. It can be done and it can be simple.
V2… here we go!
-
Make sure that the API keys are sent in the header of the request. Not as a GET parameter. The HTTP protocol already has something for this.
-
Get rid of the old structure with things like [plugin.updated.date] as a key to format data. Use “normal” key => value pairing. No more [sections_data] or things like that.
-
Do not HTML escape data in the API. I’m calling the REST API to display content at the command line.
-
Standardize date formats (dates should always be something like ISO 8601) and always display in UTC.
-
Include more information than needed. Why not include the “old” and “current” version, the slug, etc. for this call:
wp-json/mainwp/v1/pro-reports/themes?site_id=18&start_date=2023-04-01&end_date=2023-04-30&action=updated -
Allow stackable calls. Let’s say I want to produce a report for site 18. As per the current API, I have to initiate 1 call to get WordPress updates, 1 call for themes updates, 1 call for plugin updates, 1 call for… Why can’t I make 1 call where I will specify everything I want in one call. I truly doubt anyone here does only one call to generate reports. We need multiple informations and doing multiple calls is slow and not really productive.
This is new API and I just can’t see how it can be usable after playing with it for 30 minutes.
That being said, it’s great that you thought about creating an API. I’m truly sorry about the fact that I cannot see what I can do with it as it lacks basic information to just recreate what I had in my current report.
The good news is it would be fairly easy to move on to v2 and fix everything. I am available to brainstorm and make it better.
By the way, there is a comma in “mainwp-pro-reports-extension/class/class-mainwp-pro-reports.php” one line 853 after ‘get_translation_pending_tokens’ that should not be there. It crashes the code when using older version of PHP. The plugin says it’s compatible for PHP 7.0 and up… 7.2 crashes.
Feel free to use me to your advantage to create a usable version of the API. It truly think it can be a great addition to your tools.