To enable communication over a network, a set of rules for data exchanges is imperative. Such rules are typically standardized through protocols and grouped into various layers—each layer of the communication stack dealing with a specific charter. The following diagram depicts the traditional networking layers and related protocols:
Most API network communication occurs over Transmission Control Protocol (TCP). Here, before the actual data exchange, the client needs to make a connection to the server. To do this, the client needs to know the following:
- The IP address of the machine hosting the service.
- The network port on which the service is listening to requests.
- After the network connection is set up, the client will need some application layer specifics to perform the communication, including the following:
- An application protocol specific endpoint (for example, a URL in the case of HTTP)
- The data contract—what date is needed, the serialization format, and so on