API is a broadly term all types are API's comes under API(REST, SOAP, XML-RPC etc). API's are used to between different software system. they have different architectures, structures and usecases.
REST is a type of API. Not all APIs are REST, but all REST services are APIs.
- API
- API uses different protocols including http,https and tcp/ip etc. It does not follow any specific architecture or structure unlike REST API. It provides flexible interface.
- When to use API
- building complex applications.
- Types of API
- There are N numbers of API's but let me explain most commaly used API's
- API
- REST API
- SOAP API
- REST API
- REST architecture style
- REST vs API vs SOAP
- Key differences listed below.
# | API(Application programming interface | REST API(Representational State Transfer) | SOAP API(Simple Object Access Protocol |
---|---|---|---|
1 | - REST architectural style | - doesn't follow any structure | - NA |
2 | - HTTP protocol with methods (GET, POST, PUT, DELETE etc.) | - use any protocol or technology | - follows specific protocols for communication SOAP specific protocol, such as WSDL or UDDI |
3 | - returns data in JSON or XML format only | - use any data format | - uses XML as its data format |
4 | - stateless client-server model | - can be stateful or stateless | - NA |
5 | - suitable for simple applications | - suitable for building complex applications | suitable for building enterprise-level apps |
5 | Example - CRUD operations & real-time communications | Example - comming soon... | Example - comming soon... |