- API helps to communicate between two different applications and also which are coded in 2 different languages.
- For example, Google developed maps that contain open-source APIs. Maps are not only used by Google but also by different applications such as whatsapp, FB, snap etc.
- API vs Webservice: API is a request which will be developed offline without using of public server and Webservice is also an API but it is deployed in the server and made available for the public.
- All Webservices are API but all APIs are not Webservices.
- An API is called a Webservice when an API is deployed in a public server and makes it available for everyone.
Two Types of API:
- Simple Object Access Protocol(SOAP). (XML format)
- REST(Representational State Transfer). (JSON, XML, etc.)
- SOAP is a very old tool and it is difficult to understand the request and response sometimes.
- Currently, we are using REST services. we have 4 major commands to request or to get the response.
- GET - used to get the requested info from the Database.
- POST - used to create a new item in DB.
- PUT - used to update the existing item in DB.
- DELETE - used to delete existing items from DB.