What is the difference between endpoint and API?

41

I've always used endpoint and API as synonyms. Today I discovered that they do not mean the same thing, although they are related.

After all, what's the difference between these two?

    
asked by anonymous 11.09.2015 / 15:18

2 answers

47

A web service endpoint is the URL where your service can be accessed by a client application.

An API is a set of routines, protocols, and tools to build applications.

API s can exist without endpoints . In the list of windows APIs you can check which mostly treats local content - such as displaying windows, or how to manage the keyboard and mouse input .

Endpoints can also exist without API s . Imagine a simple implementation, which returns only the date and time of the server; the simplicity of the operation does not require the implementation of an API exclusively.

Nowadays it is common to refer to a collection of endpoints belonging to a given service as API , by proximity and coupling; in many cases the service is designed and planned with the exposure via endpoints in mind.

A typical implementation model can be interpreted like this:

Where endpoints are interfaces between the API and the consumer application.

    
11.09.2015 / 15:24
6

Endpoint and API have absolutely nothing in common.

Endpoint, in addition to the generic sense of "something that is at the tips", is more commonly used today in data communication, and refers to two "tips" that are communicating through some data communication protocol. p>

More specifically, the endpoint also refers to the two "points" of a TCP connection (such as a browser on the client side and a web server on the server side). In this case, endpoint is a technical term and refers to the pair (IP address, TCP port) of each end of the TCP connection.

You can see the TCP endpoints through the "netstat" command on the terminal. For example:

xx@xx~]$ netstat -an -t  
...
...  
tcp    0  0 192.168.0.24:34904  198.252.206.25:80   ESTABELECIDA
...
...

is showing a TCP connection where the local endpoint is 192.168.0.24:34904 and the remote endpoint is 198.252.206.25:80 . The IP address 198.252.206.25 belongs to a StackExchange website, and 80 is the HTTP port. Consequently the local endpoint 192.168.0.24:34904 is being used by Firefox on my computer in this communication with StackOverflow.

An API is basically a declaration set of functions, classes, structures, protocols, and conventions that are required to consume the software services provided by some provider. In practice, an API is almost always a set of functions and their parameters, in some programming language like C, Java, JavaScript, etc.

For example, writing applications for the Windows operating system uses the Windows API, better known as the WIN32 API. To develop applications for Android uses the Android API, which is basically the API provided by the Java language plus additional APIs specific to the Android system. In order to develop web applications, we use specific APIs in JavaScript, web services, REST, etc., such as those provided by Google, Facebook, Twitter, etc.

    
28.09.2016 / 04:04