API Fetcher plugin manages scheduled REST API get calls in Wordpress.
This API Fetcher plugin can perform scheduled API requests and store the results in posts and meta fields. Ideal for developers that want to practice with API data.
Installing and setting up the plugin, may be very easy, but in case you may need instructions...
- Download the zip file from this webpage, via Wordpress.org or via your Wordpress admin panel (Go to 'Plugins' -> 'Add new' and search for API Fetcher)
- Install and activate the plugin.
- Once installed, a new post type should show up in your admin sidebar, named 'API Calls'.
- To create a new API call, click on 'Add new'.
- When creating a new, or editing a existing API Call, a meta box will appear to give you all the manageable settings.
Please fill in all the necessary information carefully.
- The first field: API url needs a request url to which a Rest API should respond in JSON format, be sure to test the url when filled in.
- The API update schedule selection field allows you to select the interval frequency. When 'Once Hourly' is selected, a scheduled Wordpress event will run every hour to create a request to the API url and store the data in your selected post type. Note that Wordpress scheduled events requires page loads to trigger them.
- The next option is to select where the response of your API call should be stored. This can either be a existing post type (Posts or Pages) or a custom post type. If '- Create new post type -' is selected, be sure to fill in a title for that post type.
- When you have tested your url, or clicked the 'Get data' button. The REST API response will be shown in the box. If the response (inside the main response object) contains a object (JSON notation of a key: value pair) a box will be shown to ask you whether this object should be seen as the main content of your response, or not. (see the example in the message to get a better understanding of what it means)
- The last field is to select your unique 'key' per post. This can either be a title, a id, a unique string, or a time/date format. Every time your scheduled API Call is run, new posts (pages or custom posts) will be added if the value of this field (e.g. the title) is different.
- Now you're ready to save your past, if you've chosen to create a new post type for your API call, this should appear immediately after save. After you've saved the post it is time to wait until your scheduled event has run. (Or you can manually force it with a plugin such as WP Crontrol, which also allows you to create custom time schedules)
You can create as many API Calls as you want, though this may have effect on your storage and bandwidth of your site.
Example of post fields generated by the API Fetcher plugin
Enjoy the API Fetcher and rate it on Wordpress.org