API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to communicate with each other to exchange data, functionality in a secure and easier way. The communication between the two applications is without knowledge regarding how they are implemented, acting as a middle man that processes transfer data between them.
Open APIs- They are accessed with the HTTP protocol, which allows access network-accessible service to give universal access
Partner APIs- They are accessed through a public API developer portal that developers can access to allow communication beyond the boundaries of the company.
Composite APIs- They are collective data/service APIs. They are commonly used in performing a task that requires info from several sources
Internal APIs- They are internal APIs that are out of reach from external users. They are intended to improve communication and improve productivity.
Web service can be any form of software, cloud technology, or application as long as it provides standardized web protocols(HTTP/HTTPS) to enable itself throughout the interset using XML messaging system(Extensible Markup Language). IN hindsight web service allows communication between data and apps. Applications that formed using various programming languages can use web services to exchange data over computer networks using a device with the usage of web services
SOAP - It enables independent communication using XML
REST - RESTful servicers which use the HTTP as the supporting protocol
Ultimately web service is a subset of API as web services are APIs but not every API is a web service. This is due to the categorization of web services containing restrictions during implementation such as:
Web service requires a network to function while APIs can be done either on or offline. Webservices commonly use SOAP, REST, and XML-RPC while APIs can use any protocol.
While web service only supports HTTP protocol while API supports HTTP and HTTPS protocol.