API vs Web Service

What is an API?

 API Explained

API Explained

API stands for application programming interface. An API is a mechanism by which allow you to write code that allows interaction with another program or application.

For example Microsoft Word has an API (visual basic) that allows anyone to write a program to interact with Word.

An API can be in any programming language. To interact with that API your program or application needs to be the same language. 

Web Service

 Web Service Explained

Web Service Explained

A web service is a program written to perform a specific function or set of functions for another program over a network (i.e. internet).

For example if we were writing some Skiing application and needed weather data we could call the Yahoo Weather Web Service that returns the data we need.

Advantage of a web service is that the way to interact with the web service it is always the same (a HTTP call) and the response is always in a format that any programming language can consume. 

A web service is considered a special kind of API.