en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en de en de en de en de ru en en fr eu eu eu eu th th en ja en en en en en en en en en en en en en en en en en en en en en en en en en en en pt en en en en en en en en en en en en en en en id en en en
This WordPress Plugin will provide an interface in the WP Admin to save saving external Open Data as WordPress transients and a developer API to interact with them. You can read more about the WordPress Transients API in the Codex.
Transients can be updated manually in the Admin, but they are set to expire weekly (using the WordPress constant WEEK_IN_SECONDS).
Developer API for getting the transient data, and updating it automatically if it is expired.
You can also download the package and add it manually to your plugin directory.
A token will be sent in the header (X-App-Token) to the Open Data endpoint to authenticate your application for for saving data. This can be set in the same admin or as an environment variable $_ENV['OPEN_DATA_APP_TOKEN']. The NYCO WP Config plugin can be used to manage environment variables.
Transients can be saved by adding a valid name (letters and underscores only) and valid url. Clicking "Save Transient" will save the transient and cache the request. Once it is saved, the developer API can be used to get the data. The developer API also exposes the save and set methods used by the admin interface.
Typing the name of an already saved transient and clicking "Save Transient" will update the transient data cache.
Once the plugin is installed, you can reference the name space to use it;
use NYCO\Transients as Transients;
The transient needs to be saved with a valid name (letters and underscores only) and valid url before it can be exposed to the set or get methods.
Uses WordPress' wp_remote_get and set_transient methods to retrieve the saved endpoint and save the response body. It will expect a JSON response and will be saved as a PHP Object.
Returns a saved transient. If the transient is empty (expired) it will use the set method to re-cache it.
This plugin only provides a small interface for saving external Open Data as WordPress Transients and external data and is not a fully fledged transient manager.
Method to delete saved transients.
Option to set the expiration of transients.
NYC Opportunity is the New York City Mayor's Office for Economic Opportunity. We are committed to sharing open source software that we use in our products. Feel free to ask questions and share feedback. Follow @nycopportunity on Github, Twitter, Facebook, and Instagram.