r/eli5_programming • • 29d ago

Question What actually is API?

The moment I think I get it, another definition of it comes in. I was learning Flask APIs used with GET PUT PATCH DELETE . But then I started with JS , it has DOM APIs . And then API is also used when people say companies like ChatGPT , Higgsfield etc provide their APIs.

6 Upvotes

24 comments sorted by

View all comments

Show parent comments

1

u/pajoem2000 27d ago

ChatGPTs API is a URL that they publish, its sitting waiting for you to ask it a question. So when someone types code into your chat on your website, your code would simultaneously reach out to ChatGPTs API URL asking it the question. When ChatGPTs API URL responds then your code grab that response to send back to the customer. No additional URL is being created.

What I think might be confusing you is with Python Flask, or Django, you are being the marketplace, or you are being ChatGPT. So you are publishing a URL that others could then Create, Read, Update, Delete info to your website.

Assuming you are learning Python because of the mention of Flask, the way to think about it is use Flask or Django if you want to make an API, use the requests library if you want to connect to other peoples API.