API vs Web Service: What’s the Difference?
API vs Web Service
In August of 1991, the World Wide Web was born. It was nothing like it is today — in fact, it was slow and quite bare, with hardly any websites online. If you had your own website, you were one of the few out there!
It was even a world before Google. Google didn’t exist until 1998 and most people used Yahoo! to search the web.
As those who were tech-savvy got to know the ins and outs of coding computer languages, we were lucky enough to experience some of the most impressive innovations, available right at our fingertips over the internet.
Suddenly, we were exposed to Google, a search engine that could list everything existing on the World Wide Web.
We had email services that allowed us to talk to other people through a machine — though we later turned to instant messaging services like AIM and MSN. Eventually, websites like Myspace, then Facebook, popped up. These allowed us to create our own Internet versions of ourselves and interact with other people we’d never meet otherwise.
Social media forever changed the way we use the internet. It showed people that we could communicate with each other through a machine at our fingertips — and quickly.
It became clear that the options were limitless. Websites could replace what we do in real life if it was faster and easier.
A web service and an API are two very similar concepts, so it can be difficult to understand the similarities and differences.
Before we get started further explaining web services and APIs, we first need to define a few other terms:
- XML [eXtensible Markup Language] is a standardized format for storing and sending data. Similar to HTML, XML stores data by wrapping it in descriptive tags.
- HTTP [HyperText Transfer Protocol] is the foundation of transferring data and communications on the internet.
- SOAP [Simple Object Access Protocol] is a messaging protocol used for exchanging structured information[XML data] over a network.
- REST [REpresentational State Transfer] is a standardized architectural style that can be used when creating a web API.
- Web applications (Web app) are computer programs that are accessed over the internet through a computer’s web browser.
What is a Web Service?
A Web service is a way for two machines to communicate with each other over a network.
A web server running on a computer listens for requests from other computers. When a request from another computer is received, over a network, the Web service returns the requested resources. This resource could be JSON, XML, an HTML file, Images, Audio Files, etc.
It’s important to note the requirement of the request being made over a network.