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.
- Collect hourly or daily stock market information via a REST API and save the data in posts.
- Collect news from your favourite topic from a news REST API and give your visitors hourly updated news articles.
With the default configuration, this plugin, in itself, does not:
- track users by stealth;
- write any user personal data to the database;
- send any data to external servers (with the exception of the API Post requests itself);
The following plugins are recommended for Contact Form 7 users:
- WP Crontrol by John Blackbourn & crontributors WP Crontrol enables you to view and control whats happening in the WP-Cron system.
- 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 youre ready to save your past, if youve chosen to create a new post type for your API call, this should appear immediately after save. After youve 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.
One of the following causes can result in your API Call not creating posts.
* Your API url field is not filled in correctly and/or tested properly.
* The API response is not in JSON format (the only supported response format for now)
* Your API usage has exceeded, be sure to check that your filled in url is still accessible
* The selected Select the field of which the value should be the title of each new post has not changed in the requested API yet, so no new posts have been created.
* Your scheduled event has not run (a lack of traffic), try WP Crontrol to manually force a registered event.
If none of the above is the case, please visit the support tab.