Common methods of data transmission and data call

Common methods of data transmission and data call

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.

[[427409]]

SOAP

Its 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.

JSON

When 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.

REST

The 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.

GRPC

gRPC 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.

GraphQL

GraphQL 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.

Summarize

In 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

Recommend

Is the integrated air-space-ground information network really coming?

[[408522]] In recent years, with the popularizati...

5G and manufacturing: the missing link to drive Industry 4.0?

5G can help transform the manufacturing industry....

Let's talk about 11 main neural network structures

With the rapid development of deep learning, a wh...

How to find the IP address of the router to improve work efficiency

How to find the IP address of a router is an esse...

Considerations and conclusions of Iperf network throughput/bandwidth testing

Iperf test: Use udp to set the bandwidth to 2M, 5...

5G industry applications need to be expanded from "1 to N"

Time flies. China has been using 5G commercially ...