Table of Contents
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 rarely any websites existing. 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 the search Yahoo! to search the web.
“This is one of the fastest download times among major websites,” wrote web reviewer Jakob Nielsen in 1998. “Yahoo’s homepage has an average download time of 3 seconds.”
(Most of us couldn’t wait 3 full seconds for a search to take place today.)
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 abilities right at our fingertips.
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 popped up, where we could create our own Internet versions of ourselves and interact with other people we’d never meet otherwise.
Although Myspace faced its social media demise in the late 2000s because Facebook came around like the cool new kid on the block, 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.
As we know, the world wide web became a database of supreme capabilities.
This was only possible through the coding of servers, programs, and applications like web services and APIs. We’re now getting into the world of computer jargon, so buckle your computer-newbies seatbelts.
APIs and Web Services
Computer programming is no easy task.
It takes a lot of education to plan your own program or webpage from scratch. That’s why most people use preset applications that help make the web’s usability more user-friendly—you know, for those of us that don’t speak computer.
A web service allows a program or application to communicate with a web page. Some people call a web service an “application service,” which basically serves as the middleman between the computer and a browser.
An API, or application programming interface, is considered a web service which allows communication between two programs on a server that receives requests and sends responses.
In Normal English, Please?
It can be overwhelming trying to understand computer-speak. That’s why we’re here to simplify it for you.
Here are some important definitions to take a look at as we further explain web services and APIs:
- XML, or extensible markup language, is used to encode all communications to a web service, acting as a translator
- HTTP, or hypertext transfer protocol, is the foundation of transferring data and communications on the world wide web, where hypertext makes hyperlinks that allows the user to access other web pages by clicking with the cursor
- Web applications are a way for users to communicate with the internet’s server on a web browser, like Google Maps or filling out a subscription form for a newsletter list
- SOAP, or simple object access protocol, is a communicator during the transfer of information between a web server or an API
- REST, or representational state transfer, is the software architectural style of the world wide web
A web service is any type of software that is available all over the internet and uses an XML messaging system to “translate” what the user wants. Web services are “behind the scenes,” as they are not the forms, apps, or text boxes you may see on a website.
Here’s a great example of a web service:
Let’s say you want to buy that new and popular computer game that just came out. You’ve been dying to play it for months ever since they released a trailer.
So you head to Walmart to buy the game, but they’re sold out by the time you get there! Back in the early 2000s before web servers became more advanced, this meant that you would have to wait for Walmart to restock their shelves.
Thanks to the technologically-advanced web services, you can head back home, launch your computer, buy the game online, and have access to an instant download.
Most people buy games through third-party apps, like Origin, Steam, or Amazon. These kinds of apps act as the middleman between the downloadable file and the web browser.
If you’ve been on the internet, then you’ve had experience with an API. Most commonly, APIs are like plugins for sites, video embedding, or online video gaming and other types of dynamic content.
An API is a set of procedures used by computer programs to access services from the operating system, software libraries, or other systems. For example, when you save a document on your computer, the computer needs to know which directory to save it under, which requires an API.
Here’s a great example of an API:
You’re getting really tired of cooking every night. You’re running out of meal ideas and are admittedly a little picky when it comes to trying new things. You hate the mess that comes with the cutting board, the packaging, the pots, and pans… it stresses you out. So, you decide to look into one of those new meal delivery websites, like HelloFresh or Blue Apron.
You hop on the computer and type in one of these websites. You scroll through the questionnaires that ask you what kind of food you like and dislike, what your price range is, and how often you want deliveries. The website takes your answers and thanks to a prewritten algorithm, helps calculate your meal plans. You might not know it, but you just used an API.
Another simple example is when you’re on a website, let’s say reading the news, and you see those little social media icons at the top. “Follow us on Facebook/Twitter/YouTube!” it says. Embedding social media plugins like this requires an API.
Is REST API a Web Service?
A REST API is a design pattern for APIs. So in simple terms, without API, you can’t have REST.
REST was officially defined by computer scientist Roy Fielding in 2000 during his Ph.D. dissertation. It essentially changed the way computers read information, allowing clients to interact within applications, like creating or editing a blog post on sites like WordPress.
A successful REST needs two key qualifications:
- The client: The user or software of the API that wants to perform a task, like creating a new tweet.
- The resource: The object that the API can provide information for, like an Instagram user, photo, or hashtag.
Let’s say that you want to see what your best friend posted on Instagram. To do this, you need to go on the app and search for their username.
Here’s how the REST API works:
When you, the client, go to the Search bar, you are calling the Instagram API to bring up the resource, which is your friend’s username. Then the API responds to the request by displaying the name, followers, and posts—which is your friend’s page.
Another example: You are writing a blog post on WordPress and hit “Publish.” Then you notice that there is a typo, so you have to edit the post to quickly fix the typo.
Here’s how the REST API works:
When you, the client, hit the “Edit Post” button, you are calling the WordPress API to bring up the resource, which is the text box. Then the API responds to the request by displaying the text box with the content you’d just written.
The Core Differences
If you got a little lost reading about APIs and web services, then abide by these simple summaries.
- APIs are application interfaces, meaning they are visual and interactive, like a social media plugin or a submission form you may fill out on a web page
- Web services are the “behind the scene” language between a program and the internet browser, like what happens when you hit the “Submit” button and receive a confirmation email
- All web services are APIs, but not all APIs are web services
- REST APIs are when the server will transfer the requested resource to the client
We hope that this article has helped you sort through the differences, ins and outs, and general information you may need to know for an API and Web Service.
Get Started with APIs
Ready to begin working with APIs? Start browsing over 8,000 APIs within RapidAPI’s API Marketplace and test API calls right in the browser. Build something awesome today!