Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST API entry point and endpoint

Tags:

rest

endpoint

What is a REST API entry point and how is it different from an endpoint?

I have searched for various definitions online but still can't seem to wrap my head around them (I am new to APIs in general). From what I understand, they provide means of communicating with the server but what are they exactly and how are entry points and endpoints similar or different?

like image 577
David Sarpong Avatar asked Nov 07 '18 23:11

David Sarpong


People also ask

What are the 3 components of a RESTful API?

A REST message contains these components: Resource Path. HTTP Verb. Body.

CAN REST API have multiple endpoints?

Often, each REST API offers multiple endpoints from which you can get the data.

Where can I find REST API endpoints?

Through the dataset URL: You can get the API endpoint by simply taking the dataset's UID and replacing it in this string: https://domain/resource/UID.extension *where the extension is the data format you's like to pull the data as. For a full list of extension formats please go here.

What is the difference between a route and an endpoint?

Routes vs Endpoints Endpoints perform a specific function, taking some number of parameters and return data to the client. A route is the “name” you use to access endpoints, used in the URL. A route can have multiple endpoints associated with it, and which is used depends on the HTTP verb.


2 Answers

Agree with Roman Vottner here and gave a thumb up. I only want to add a few more links here for anyone trying to get a clear idea.

API Endpoint

I like the answer here: https://smartbear.com/learn/performance-monitoring/api-endpoints/

Simply put, an endpoint is one end of a communication channel. When an API interacts with another system, the touchpoints of this communication are considered endpoints. For APIs, an endpoint can include a URL of a server or service. Each endpoint is the location from which APIs can access the resources they need to carry out their function.

And samples here: What is an Endpoint?

https://example.com/api/login
https://example.com/api/accounts
https://example.com/api/cart/items

API Entry Point

Look here: https://restful-api-design.readthedocs.io/en/latest/urls.html

A RESTful API needs to have one and exactly one entry point. The URL of the entry point needs to be communicated to API clients so that they can find the API. Technically speaking, the entry point can be seen as a singleton resource that exists outside any collection.

So, following the previous example, it would be:

https://example.com/api

Extra note: in GraphQL world, there is a single endpoint for the API, no entry point (https://graphql.org/learn/best-practices/#http). Usually in the form

https://example.com/graphql
like image 149
tiomno Avatar answered Sep 16 '22 14:09

tiomno


Simply speaking an entry point might be something like http://api.your-company.com which a client will enter without any a-priori knowledge. The API will teach the client everything it needs to know in order to make informed choices on what things it could do next.

Regarding Endpoints Wikipedia i.e. state the following:

Endpoint, the entry point to a service, a process, or a queue or topic destination in service-oriented architecture

In a broad sense, the endpoint is just the target host invoked that should process your request (or delegate to some other machines in case of load balancing and what not). In a more narrow sense an endpoint is just the server-sided stuff invoked that is processing your request, i.e. a URI like http://api.your-company.com/users/12345 will ask for a users representation (assuming a GET request). The concrete user is the resource processed while the endpoint might be actually a Spring (or framework of your choice) based service handling all requests targeting everything http://api.your-company.com/users/* related.

like image 29
Roman Vottner Avatar answered Sep 16 '22 14:09

Roman Vottner