vendredi 21 février 2020

Where is the distinction between a web application and an API?

This question is highly related to this over question. I'm asking another question between I still am a bit confused on the topic.

The Issue I Ran Into

I currently have a Django web application where users can have a list of their hobbies and can increment a counter each time they do one of their hobbies. My issue is, I want to extend this functionality outside of a front-end experience. In other words, I want users to be able to increment their hobbies using a POST request, say, from the terminal or from their own script or something.

Where I'm Confused

Do I have to create an API for my webapp to add this functionality?

Another way to put is, do I have to handle requests coming from the front-end differently than requests coming from somewhere else? Would front-end requests go to the URL www.hostname.com/hobbies/1 and other requests go to the URL www.hostname.com/api/hobbies/1?

If I do route the POST requests to the same URL as the requests coming from the front end (i.e. www.hostname.com/hobbies/1), then how come google has external APIs for Google Maps? It seems like if other web applications are calling Google Maps functionality then Google has separated those instances from their front end.

Aucun commentaire:

Enregistrer un commentaire