Search This Blog

Sunday, July 24, 2022

Differences between APIs and Web Services, WCF Service

APIsWeb Services
Although both essentially have the same purpose, not all APIs are web services.All web services are APIs.
APIs have several types. They support multiple response formats, including XML, JSON, or any other format. Web API’s MediaTypeFormatter formats these responses.Web Services supports XML.
API is simple to implement and has a lightweight architecture.Web services need a SOAP protocol to send or receive data over the network, requiring a high-performance architecture.
Any application that supports either JSON or XML can benefit from APIs.Web services can be used by those applications that use XML for communication.
APIs are versatile with their communication. You can write them in GraphQL, create a RESTful API, or use Web APIs that provide methods instead of calling an endpoint.Web services can use three types of design styles, i.e., REST, SOAP, and XML-RPC, for communication.
It supports both HTTP and HTTPS protocols.You can only use it with HTTP protocol.


FeatureWEB APIWCF
Content formatAny media formatSOAP+XML
Service interfaceURL Patterns, HTTP methodsService contracts
State managementStatelessStateless with Per Call
Caching mechanismBuilt in to HTTP Prefer application controlHandled by application
Error handlingHTTP status codes filters, exceptionsFaults, behaviors
TypesOpt-outOpt-in