Challenge: API Based Plugin
As part of the application process, you’ve been requested to complete the following challenge. If you have any questions please respond to the last email you received from our team.
You will be making a simple plugin that retrieves data from a remote API endpoint, and makes that data accessible/retrievable from an API endpoint on the WordPress site your plugin is installed on. The data will be displayed via a custom block and on an admin WordPress page as described. A simple WP CLI command is also required.
- Using the GET HTTP Method accessible endpoint https://miusage.com/v1/challenge/1/ (there are no parameters to/from required), create an AJAX endpoint in WordPress that calls the above listed API endpoint to get the data return. Your AJAX endpoint should be usable whether the user is logged in or not (authentication of the AJAX endpoint is not required). The endpoint should always return the data when called, but regardless of when/how many times your AJAX endpoint is called, it should never request the data from our miusage.com endpoint more than 1 time per hour.
- Create a WP CLI command that can be used to force the refresh (override the 1 time per hour limit described above) of this data the next time the AJAX endpoint is called
- Create a WordPress admin page which displays this data in the style of the admin page of the WordPress plugin WP Mail SMTP and add a button to refresh the data.
- Ensure to properly escape, sanitize, and validate data in each step as appropriate using built in PHP and WordPress functions.
- Ensure all user facing strings/text is translatable.
- The code you submit should not be built with/by/from nor use boilerplate templates/libraries/code.
- Use modern PHP approaches/architecture (example: OOP, autoloading, PSR4, Composer, etc).
- Please include all development resources (
package.json, etc., if/where applicable).
- Put your name in the plugin title, and use in the plugin prefix, slug, folder name, etc.
- Your submission should be a fully functional WordPress plugin meeting the requirements listed above.
- Do not rush! Your code will be used to gauge your abilities and your attention to detail (one of our core values).