A web service is a type of technology that, through certain protocols and standards, enables communication between different computers and allows data to be exchanged between them, in other words, a web service is a kind of API (Application Programming Interface).
Characteristics of a web service
A web service is designed so that its interface is represented in a format that a computer, whose specifications have been written in WSL, can represent.
Generally, you will use the HTTP protocol however, the following protocols can also be used:
Is an API a web service?
A web service is a kind of API but a API It may or may not be a web service. A API specifies how the software components should interact with each other. It is a set of routines and protocols whose responses are returned using the structure of a JSON or XML to represent the data. In addition, APIs are characterized by being able to use any type of communication protocol, without being limited as web services are.
And then came.. REST
REST (Representational State Transfer) is a concept that emerged in 2000 through a doctoral thesis by Roy Fielding, who is one of the main authors of the HTTP protocol specification.
One API REST makes use of the HTTP protocol to obtain the data, which are exchanged through a JSON or a XML (with the XML much less common to see). The API REST are characterized by the status is represented on the transferred resource so that the call does not maintain the status. In addition, REST explicitly uses HTTP methods, the most common of which are
- GET: used to obtain a resource.
- POST: used to create a resource on the server.
- PUT: used to update a server resource or change its status.
- DELETE: Used to remove a resource from the server.
On the other hand, the API REST offers the following advantages:
- Separation between client and server.
- Visibility, reliability and scalability.
- It is always independent of the platform and language.
eCommerce and APIs
In the area of eCommerce, APIs play an important role as they offer a number of advantages for order management, price details, catalogue updates and customer data. Here are some of the examples where APIs are used in eCommerce
- Product APIsThe product identification and description, images, brands, prices and discounts can be extracted.
- APIs for catalogsThe "Catalogues" are used to create, edit and manage the catalogues in a short time. They can be the starting point for inventory management or the generation of analyses and reports.
- APIs for paymentsThe payment platform is fundamental in an eCommerce, therefore, banks offer their POS in a virtual way, which make use of APIs for the exchange of information.
- Shipping APIsThe eCommerce website: like payments, shipping is another fundamental part of an eCommerce website. Companies like the post office offer a API so that orders can be "tracked" by customers.