Blog

Beyond the Page: An Introduction to Web Services (for Humans)

Abstract image with triangles attached by lines

One of the (many!) things we’re looking forward to in Drupal 8 is greatly improved Web Services support. What are Web Services, I hear you ask? Let me guess, you’re a human, aren’t you?

The World Wide Web was originally designed to serve static pages of text content to humans reading those pages in a Web browser. The browser sent a request for a specific page to the server, using a language called HTTP (hypertext transport protocol). The server then responded to the browser, also using HTTP, with the content of the requested page. Interspersed in the text of the page were special instructions (written in another language called HTML, hypertext markup language) that told the browser how to format the page for the human. In which font should the text be displayed – and how big and in which color? Where did Drone paragraph end and the next begin? Which words were links, and where did those links go?

As websites grew bigger and more complex, the humans running those sites started getting cranky, because they had to manually edit every HTML file every time a new page was added to the site or the graphic design changed. Before long, those humans started writing programs to help them out. The first Content Management Systems let the humans write the content and the instructions for formatting that content (the template) separately. When a request from a Web browser came in, the CMS would take the content of the page, format it according to the rules in the template, and generate the final HTML file on the fly. With the new ability to generate HTML pages dynamically like this, sites could grow to thousands or even millions of pages. Before long, the actual content of a site could be generated dynamically. Now the humans using the Web browsers could search huge databases, or shop in big e-commerce stores. As a modern web CMS, Drupal is really good at managing large sites with lots of dynamically generated content. But at the end of the day, it’s still expecting that the HTML it’s generating is going to be read by a human using a Web browser.

But we humans aren’t the only ones using the Web anymore. Maybe the “browser” talking to your website is actually another website, requesting content that your site is sharing with another organization’s site through a cooperative arrangement. Or maybe it’s a “big data” application that’s pulling information from your site and half a dozen others all over the Web. Or maybe it’s an iPhone app, sending in a new contact record from one of your organization’s on-the-street canvassers. Or maybe it’s a Web-connected thermostat, or a car, or even a toaster. The so-called “Internet of things” is rapidly changing what the Web is, and what a Web site can do. HTTP and HTML are great for transmitting and formatting content to be read by humans in Web browsers. But for machine-to-machine communication, those old protocols are being supplemented by web services, using a new alphabet soup of acronyms like REST, JSON, XML, and SOAP.

It’s been possible to use web services in Drupal for quite awhile now. But Drupal 8 will speak these protocols out of the box, making it a great choice to power your website as the Web moves into the “post-page” era. But even if you can’t wait for Drupal 8 to make your site talk to other databases, mobile apps, or even Web-enabled toasters, get in touch with the friendly humans at 4Site.