Web Services and APIs are getting popular and used in many known websites we use in daily basis. For that matter, I'd like to put some general definitions that may make it clear to deal with
An application programming interface (API) is a set of routines, data structures, object classes and/or protocols provided by libraries and/or operating system services in order to support the building of applications.
A Web service (also Web Service) is defined by the W3C as "a software system designed to support interoperable machine-to-machine interaction over a network"
All Web services are APIs but all APIs are not Web services.
Web services might not perform all the operations that an API would perform.
A Web service uses only three styles of use: SOAP, REST and XML-RPC for communication whereas API may use any style for communication.
A Web service always needs a network for its operation whereas an API doesn't need a network for its operation.
An API facilitates interfacing directly with an application whereas a Web service interacts with two machines over a network.
Web service is like advanced URLs and API is Programmed Interface.
API contains classes and Interfaces just like a program.
A web service is a form of API (Application Programming Interface).
An API is used by a computer programmer to establish a link between software applications. This interface can take several forms, a web service is just one of these.
There are several types of web service. SOAP (Simple Object Access Protocol) is one of the most common. The API takes the form of a service description (WSDL) which is used to automatically generate the program code which makes the connection.