I'm developing an API using Flask and the Flask-RESTful extension. I'm creating my endpoints and resources, but I'm confused with the difference between the resource "url" and its "endpoint". To my understanding, the URL itself is the endpoint. I was also reading the answers to this StackOverflow question and they also suggest that an URL is an endpoint.
Yet the Flask-RESTful docs mentions that the add_resource
method has an argument for URLs and it can also receive an endpoint name. They even provide this example:
api.add_resource(HelloWorld, '/', '/hello')
api.add_resource(Foo, '/foo', endpoint="foo")
api.add_resource(FooSpecial, '/special/foo', endpoint="foo")
In which I understand what they are doing, but again I don't understand what the endpoint name does.
What is the difference between the URL and the endpoint name? And why would I set an endpoint name?