=== JAVASCRIPT CLIENT HANDLE for the WP REST-API === Contributors: oluwasegun27 Contact email: oluwasegun.somefun@yahoo.co.uk Tags: wpapi, basic authentication, cookie authentication, node-wpapi, javascript client, wp rest-api Requires at least: 4.8 Tested up to: 4.8.1 Stable tag: 1.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html == Description == - Access the WP REST-API directly in any javascript file using the WPAPI's 'wp' global object. OR - Provides the global variable 'wp', which is accessible and authenticated for use in all javascript files in a WordPress installation to access the WP REST-API from inside your Wordpress installation both when an admin user is logged in and out of WordPress. == Warning == * This plugin includes code from the JSON Basic Authentication Plugin. So JSON Basic Authentication plugin must not be installed else WordPress throws a conflict. ## Install == Installation == 1. Download the plugin into your plugins directory. 2. Go to Plugins Dashboard. Activate 'JAVASCRIPT CLIENT HANDLE for the WP REST-API' 3. The Plugin is now activated, under it are the links: Settings | Deactivate | Edit 4. Click on this Settings link or on the WordPress Dashboard, Click on the "WPAPI Client Authentication" sub-menu of the Settings menu. 5. Enter any Administrator username and password, to validate Basic Authentication. 6. Go to your live site. e.g: http://wpsite.com or http://localhost:8080 7. Check your browser console: If your administrator's name is Matt, then you should see a console output: "Matt! I am set to access the WP REST-API!" 8. When the admin user logs out, cookie authentication is automatically enabled by default. You are all set. 9. Open any .js script and start accessing the WP REST-API via the node-wpapi client e.g : To get all the posts on your WordPress model site. wp.posts().embed().get().then(function( response ) { console.log( response ); //do something with returned data }); * See http://wp-api.org/node-wpapi/ for more info. N.B: - Mozilla Browser Console: Tools > Web Developer > Web Console - Chrome Browser Console: More Tools > Dveloper Tools > Console == Frequently Asked Questions == =What is the WP REST-API?= * Check up : https://developer.wordpress.org/rest-api/ =Why should I use node-wpapi.js client?= * Check up: http://wp-api.org/node-wpapi/ =What does this plugin do?= * Installs and Accesses the node-wpapi.js isomorphic client * Provides the global variable 'wp', which is accessible and authenticated for use in all javascript files in a WordPress installation to access the WP REST-API both when an admin user is logged in and out of WP. == Screenshots == 1. Settings Page 2. Browser Console Success Result == Changelog == = 1.0 = First Release : * Installs the node-wpapi.js CLIENT. * Serves as a Cookie and Basic Authentication handler for the WP REST-API. * Access the WP REST-API in any javascript file using the WPAPI's 'wp' global object directly. == Upgrade Notice == = 1.0 = This is the first version of this plugin.