Plugin / API Request Collector

Aaron Brazell

Description

Description

This is a very simple plugin that creates a new adminbar menu with a list of pertinent API calls used on a page.

However, no good thing happens in a vacuum, and you good folks, are developers.

In order to log API calls, you should invoke the log_api_call() method of the $ab_api_logger global object. Of course, if you prefer, you can instantiate your own object using the AB_API_Logger class.

The log_api_call() method takes two properties. The first is an array of URLs that will be included as menu items (easy access, easy click to see responses). By default, the plugin maintains a property $api_calls with this array and uses it to parse out the menu items.

However, if you wish to maintain your own array, you can do that too. The plugin takes care of what it needs, and you can feel free to maintain what you need.

The second argument for the log_api_calls() method is the URL that will be added to the adminbar menu. You can escape it if you want, but I will as well for security.

The reason I built this plugin is because I deal with APIs a lot. My normal approach to API integration is to use a pre-existing PHP library or, more commonly, build a library around the API so I can use it easily without having to remember everything.

Usually, this means I create a class and that class is filled with methods that construct a URL based on parameters and then use wp_remote_get() to retrieve the response from the API. Anytime after the URL is created, invoke this plugin:

if( class_exists( 'AB_API_Logger' ) ) {     // Example API Call: $api_url (http://api.example.com?apikey=asdfASD234&post_id=213)     global $ab_api_logger;     $ab_api_logger->log_api_call( $ab_api_logger->api_calls, $api_url ); } 

Pull requests can be submitted via Github

Ratings

0
0 reviews

Rating breakdown

Details Information

Version

0.1

First Released

30 Apr, 2013

Total Downloads

768

Wordpress Version

3.5.1 or higher

Tested up to:

3.6-beta1

Require PHP Version:

-

Tags

Contributors

This plugin has been closed.

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.