There was lots of support for web services in Drupal 7 and even some in Drupal 6, but it was all done through add-on modules. Drupal 8 brings that support right into Drupal core — with some kick-ass improvements.
A web service is a technical service that comes from Drupal in order to get information from or push data to the Drupal website. That service could be anything from an inventory management system to a payment gateway. The service in this sense is not meant to be used by a person, but rather by another system.
Drupal supports these web services with a RESTful setup. REST is currently the most popular platform-independent format for sending data back and forth. So anything else that knows RESTful can connect to Drupal and understand the data it gets from Drupal.
Drupal 8 supports that for every piece of content it handles: blog posts, customers, views of data...anything you can do you can request from Drupal, which is pretty cool.
A Super Easy Setup
You can set up the REST services completely through the user interface, no programming required. You can go into the services UI, click the box to give access to nodes, and get the link it generates to explain how to give access to all your content nodes. You can even specify which accounts should have permission for it.
If a third party wants to hook up to your system, you can just give them the endpoints. And it’s self-documenting — when that third party connects to Drupal, they get the documentation that explains what the data is going to look like.
So if you’re a site owner and you need to pass this on to someone else to do a technical implementation, you can totally do that yourself.
Linking Data Through Web Services
With Drupal 8, you can link data to other data through web services. So if someone requests a node from you, in that node you can include all the other related products that are attached, and they can follow those links through the web service and get all that data as well.
This means that through a service, people can discover all the content on the site, just like they could if they were browsing it. They don’t have to know exactly what to look for.
You can just provide these services and the people who connect to it can figure out exactly how they want to deal with the data. Each time they come with a new idea for how to use the data, you don’t have to change how you serve it up, because you’ve already served it all up. They can do it all on their end.
Web services come with authentication built in. Drupal 8 uses HTTP by default, but you can attach OAuth and other means of authentication. You can just turn on these permissions for someone’s Drupal account and it works for web services. You can manage the permissions just like you would for anything else; it’s literally just another set of checkboxes.
Views as Services
Views are in Drupal core now, and can be exposed through services. If you build a view (top products, most viewed items, whatever), you can make a version of that view that is a web service. Then you can pass it off to everyone else. Easy peasy.
Why All This Rocks
If someone is trying to hook up with your site, Drupal 8 will save you a whole lot of effort. Instead of going to your web development company and asking them to come up with a spec and build the actual service, you can generally just turn some checkboxes on. It could honestly take you half an hour.
To learn more, check out our High Five episode “The Best Features of Drupal 8 — Web Services.”
Subscribe to our YouTube Channel for more Drupal Commerce goodness!