What is the difference between directly returning data and Web service by getting the value of Post/get? What are the pros and cons?
Suppose to make a simple API:
Get commits the UserID and type, obtains both values after determining whether the UserID exists in the database, and returns the data based on the type if it exists.
How does this API work better in either of these two ways?
Reply to discussion (solution)
From the point of view of data acquisition: all the same
Are services that provide data
The difference is that a WEB service provides a public data service that contracts incoming outgoing data formats and methods through WSDL
Post/get provides private services, and the data format has your private agreement
Add
If you are developing APIs for your own website, I suggest you use REST. Of course the use of the station is also REST
This makes it possible to expose the REST string when you need it, without having to develop the API separately.
Add
If you are developing APIs for your own website, I suggest you use REST. Of course the use of the station is also REST
This makes it possible to expose the REST string when you need it, without having to develop the API separately.
Thank you, moderator teacher.
In fact, the difference between RESTful APIs and Web service is still not clear. Is rest not a design pattern? So what is the specific way to implement it? Post/get?