You might also be worried about what making the switch means for your site’s performance and your users. Will it affect the user experience? Will it impact on your SEO? How fast will your site run? The REST API is very new so it’s sometimes hard to find concrete answers to these questions.
In this post I’m going to look at some of the things that might concern you when you’re considering working with the REST API. I’ll identify which of these you need to worry about and which you don’t. Hopefully after reading this post you’ll have a better idea of whether the REST API is for you.
I’m going to look at:
But first, let’s just remind ourselves of what the REST API is and the possibilities it offers us as developers.
The REST API: What Is It?
REST stands for REpresentational State Transfer, which I’ll admit doesn’t tell you much at all. Wikipedia clarifies things a little:
“RESTful systems typically, but not always, communicate over Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) that web browsers use to retrieve web pages and to send data to remote servers.”
In WordPress terms, that means using HTTP to access the data in your site’s database, rather than sending database queries directly using PHP or SQL.
This opens up two main opportunities:
Because you’re not limited to PHP, you can build applications based on your WordPress data on other platforms, such as mobile. So you could have a normal PHP-based WordPress site and also build a mobile app that uses the data from that site, updates that data where relevant, and can have a completely different design from your website. You could also build a desktop app like Automattic’s Calypso app for WordPress.com
So if you’re creating simple websites (brochureware, blogs or information repositories, for example) you’re unlikely to need to use the REST API. But if you want to build something that’s much more interactive and reacts quicker to user inputs, then the REST API opens up all sorts of possibilities.
Now let’s move on to looking at the potential barriers to using the REST API and which ones you should or shouldn’t worry about.
POINTS & REWARDS
Work hard, play harder
We believe that when you help us, we should help you. So, for every time you do something awesome, we’ve built in reward points to show our gratitude. Redeem them for free membership time, T-shirts, and other gear.
Everyone wants their site to perform as well as it can. Increasing your site speed will minimize the risk of losing visitors and boost your search engine rankings. If you aren’t already running a performance plugin (like our Hummingbird optimization plugin) on your WordPress site, you should.
But what does using the REST API do for performance?
This means that you should resist the temptation to load all of your scripts straight away on loading your home page or SPA’s main page. Any scripts that aren’t necessary on page load should be loaded at the end of your page and not in the section.
But it’s not all doom and gloom. Working with the REST API can improve your site’s performance in other ways. This doesn’t relate to page load but to the speed of interactions. As the REST API lets you store data locally in the client (i.e. the browser) rather than on the server, it means that when your user does something that means more data needs to be loaded, then that will happen much quicker.
So the answer is that using the REST API will only impact on your site’s performance if you don’t take care of your code and that once a user is interacting with a page it can improve performance.
Which brings us on to User Experience, or UX. Using the REST API to build an app-like site can significantly enhance UX, but only if you understand your users and what they expect.
Whatever kind of site you’re building and whatever technology you’re using, good UX doesn’t stem so much from the technology as it does from an understanding of your users and their expectations and needs. If your users come to your site wanting a nimble application that responds quickly to inputs and lets them manipulate data in a way they can’t with a standard WordPress site, then the REST API will help you achieve this. But if your users expect to consume content, then what’s more important is the ease of accessing that content and the speed with which it loads. The REST API won’t add anything here.
Another area in which the REST API can improve UX is by making it easier for you to build a mobile app that supports your desktop site and mirrors it in a way that’s designed for mobile. Don’t just port the design of your desktop site over to mobile and expect that to work for your users. Developing a mobile app is a very different discipline, and you need to understand your users’ expectations of the interface and of how your app will work. Working with the REST API makes it much easier for your to do this than if you simply developed a responsive site, for example.
Make sure you have a thorough understanding of the interface you’re working with and your users. Do user testing and research and if you’re developing a mobile app, familiarize yourself with the guidelines on the interface for the operating systems you’re developing for.
SEO sometimes feels like the holy grail of web development. When I’m talking to clients or potential clients, all they seem interested in is how high their site ranking with Google will be.
There’s more to it that that of course – you need to maximize conversions, so that once you’ve hooked those visitors using SEO, they do what you want them to and don’t leave your site.
The site for Themeconf, for example, is built using the REST API. When I search for it on Google, it shows up just as you would expect:
So there may be an impact on your social media links but not on your SEO directly.
WebAIM say that:
Test all of your pages individually using an accessibility tool like WAVE and edit them accordingly.
Conclusion: Things Are Better than You Might Think