What is the difference between endpoint and API?

Asked

Viewed 68,185 times

56

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?

3 answers

85


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

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

APIs can exist without endpoints. In the list of windows Apis you can check that the vast majority deals with local content - like displaying windows, or how to manage the input keyboard and mouse.

Endpoints can also exist without APIs. 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 a API exclusively for this purpose.

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 keeping in mind the road exposure endpoints.

A typical implementation model can be interpreted like this:

inserir a descrição da imagem aqui

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

  • 9

    (Pitaco) I’m more purist about the definition of API: if it exposes a public interface (set of routines that can be called by a client) then it is an API, without distinction about being a tool or protocol. In this case, it seems to me that an endpoint cannot exist without an API, because there is a public interface (the URL) and the client of that interface (who calls the URL).

  • 2

    @Piovezan This is an interesting definition, and I understand your (valid) point of view. But this definition of API could be applied to any object with public properties that is met by another; I would say a minimum level of process complexity is necessary to deserve this definition. A discussion about what defines an API, framework or platform can be a question with very interesting answers

  • 2

    True. I particularly found myself satisfied with that definition of platforms and frameworks, added to the idea that a framework is an optional resource; it facilitates the implementation of an application, although imposing a way of doing, but it would give to do the application without it, although with more work.

13

Endpoint and API have absolutely nothing in common.

Endpoint, in addition to the generic meaning of "something that’s at the tips", is most used today in data communication, and refers to two "tips" that are communicating through some data communication protocol.

More specifically, endpoint also refers to the two "tips" of a TCP connection (such as a client-side browser and a server-side web server). 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 via 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 network site, 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 set of declaration functions, classes, structures, protocols and conventions that are necessary to consume the software services provided by any provider. In practice, an API is almost always a set of functions and their parameters, in some programming language such as C, Java, Javascript, etc.

For example, to write applications for the Windows operating system uses the Windows API, better known as the WIN32 API. To develop applications for Android is used the Android API, which is basically the API provided by the Java language plus additional Apis specific to the Android system. To develop web applications, specific Apis are used in Javascript, web services, REST, etc, such as those provided by Google, Facebook, Twitter, etc.

-3

An endpoint is the location where Apis can access a resource. A web service endpoint is the URL + URN = URI.

  • 1

    Hello user. Before the other responses of the post your response sounds a little devoid of details. Try to add information that complements the discussion in a healthy way especially on questions that have been asked for some time.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.