Since the beginning of the REST API project, authentication has been one of its biggest challenges. Although cookie-based authentication solves issues for JavaScript code running on the site, external sites have a more difficult time, which makes authentication in the REST API project inadequate. Co-founder of Human Made Joe Hoyle on Sunday announced the Authentication Broker System, a solution that aims to solve the decentralized registration problem. The broker can be found at https://apps.wp-api.org/, where you can sign up as a developer and create your app directly. In addition, the specifications for the system can be found at https://apps.wp-api.org/spec/. The two biggest roadblocks to authentication […]
Unit Testing Custom WordPress REST API Endpoints
I’ve written a lot about the WordPress REST API for Torque, but one thing I have not covered is unit testing custom APIs. That is exactly what this article is. I used a PHP program run the code and compare the results to an expected value. If you want to learn more, I would recommend reading Pippin Williamson’s series on WordPress unit testing. It’s quite excellent and covers how to setup your local environment for testing and how to write tests. For example here is a very simple test: <?php function answer(){ return 42; } class Test_42 extends WP_UnitTestCase { […]
Working With Users Via The WordPress REST API
WordPress’s robust user management system is an attributing factor to its overall success as a content management system. The WordPress REST API opens up a realm of new possibilities for this system, which makes WordPress a better, more powerful CMS. With the capabilities of the REST API, WordPress’s user management can be leveraged in web applications. It also allows theme developers to create more dynamic links between content that will highlight the author and their posts. This article provides an introduction to working with user data via the WordPress REST API. You’ll also learn how to create a profile editor […]
Processing Forms with AJAX Using the JSON REST API
Update: For more information, you can download our free ebook, The Ultimate Guide to the WordPress REST API. In this article, I’m going to demonstrate how to write a simple plugin to create and edit posts using the JSON REST API. While this could be the basis of a cool, front-end editing plugin — with the addition of some fields and CSS, and the implementation of the TinyMCE or similar, of course — the point isn’t to reverse the engineering of the WordPress post editor, but rather to introduce you to processing form data using the REST API and AJAX. After you understand how […]
Connecting An Angular App To The WordPress REST API
In a recent Torque article, I gave a basic introduction to AngularJS using the WordPress REST API. I also had the privilege of presenting on this topic at WordCamp Miami and will be covering AngularJS with WordPress at an upcoming webinar for WP Engine. This topic is important to me because I think that embracing API-driven JavaScript interfaces will help us bring the experience of WordPress forward and ensure that WordPress continues to be known for the quality of its interface. My personal choice in a JavaScript MVC framework is Angular. You may prefer a different one, but for my work, […]
No Comments
Start the conversation