With the Internet and the Internet of Things highly developed today, it seems that everything can be connected, and the way to connect and communicate with each other is API. For API, there are many ways to transmit data. Today we will talk about the evolution of API communication.
SOAPIts full name is Simple Object Access Protocol. It is the earliest communication protocol used for data transmission. It defines the parameters and types of service calls, the text format, and the response method through XML. It can be transmitted through HTTP protocol, SMTP protocol, or TCP protocol. Due to the length of XML, its transmission data will increase greatly when there are too many messages. Therefore, the data transmission method of SOAP has gradually been eliminated from the stage of history. JSONWhen the XML format contains too much redundant data, people find that the JSON data format can transmit more information, and JSON is supported by many programming languages. Therefore, more and more APIs use the JSON data format to provide external services. It can be said that the third-party APIs that are now open will definitely provide the interface data format of JSON. Of course, some third parties will also return the data communication format of XML in the payment interface. RESTThe full name of REST is the state change of resource representation. It is an architectural style used to constrain the search and location of resources. It is not the data transmission format, nor does it simply constrain the data transmission format. It constrains the way the state of resources changes. It regards everything as a resource. The representation here refers to any data format such as json, xml or html, including image format. State change refers to modifying its state through actions such as GET, POST, DELETE, PUT, etc., so that its state increases, decreases, is deleted, etc. REST provides a stateless service that does not record the visitor's last access status. Although many problems can be solved by REST, such as transaction mapping, addition, deletion, modification and query mapping, and document mapping, there are still many cases where REST cannot use all mapping situations. GRPCgRPC is a modern lightweight communication protocol from Google. It is mainly used to solve the problem of remote procedure calls. In a distributed system, each system often needs to call the services of other systems. In addition to calling through the http interface, there are other calling methods, and gRPC is one of them. It is a very effective method that utilizes the characteristics of HTTP/2 and solves the problem of synchronous sending. It can perform broadcast sending and multiplexing. Through one connection, it can transmit more messages. It uses a binary data format, which greatly reduces the volume of data transmission compared to text formats such as json and xml. The same bandwidth can transmit more messages faster. GraphQLGraphQL is a query language that is particularly advantageous for querying graphs (graph data), so it is called GraphQL. GraphQL was invented by Facebook. It provides another way to query APIs. It can return different data based on different query conditions through an interface. GraphQL allows you to ask for what you want in a single query, saving bandwidth and reducing waterfall requests. It also enables clients to request their own unique specification of data. Using GraphQL, API developers create a schema that describes all the possible data that clients can query through the service. A GraphQL schema consists of object types, which define what kind of object you can request and what fields it has. When a query comes in, GraphQL validates the query against the schema. GraphQL queries can not only obtain the properties of resources, but also further query along the references between resources. Typical REST APIs have to load multiple URLs when requesting multiple resources, but GraphQL can get all the data your application needs with a single request. In this way, applications using GraphQL can perform fast enough even on slow mobile network connections. SummarizeIn the era of the Internet of Things, people always need to deal with third-party interfaces or provide interface services to third parties. We always hope that our programs can be faster, more efficient and more convenient. Therefore, developers continue to develop and improve technology. The interface service of the future is not what services are provided by third parties for users to use, but what data users want can be retrieved from third parties. |
<<: Bharti Airtel, Ericsson trial 5G network in rural India
>>: Automating network verification for smoother changes
[51CTO.com original article] The classic scene in...
On January 26, the State Council Information Offi...
HostYun is an old niche personalized IDC founded ...
[[408522]] In recent years, with the popularizati...
[[185497]] As my country accelerates the implemen...
5G can help transform the manufacturing industry....
With the rapid development of deep learning, a wh...
According to customer service, the 5G network tra...
CMIVPS is a Chinese hosting company founded in 20...
How to find the IP address of a router is an esse...
Although 5G will enter a new stage of large-scale...
Iperf test: Use udp to set the bandwidth to 2M, 5...
[[386495]] This article is reprinted from the WeC...
Time flies. China has been using 5G commercially ...
It has been more than a year since I shared infor...