How does an API work?

Santosh Updated by Santosh

How does an API work?

Consider an API your waiter at a restaurant. He’s the interface between you (the customer) and the back of the house (the Chef and the kitchen).

You can request something from him, and he’ll go fetch it for you. You can ask for more information about an item on the menu. You can place an order for items from the menu.

And just like any other restaurant, your waiter (the API) cannot bring you anything that isn’t made available by the kitchen (the App). 

Meaning that, if you order tacos in an old school Italian restaurant, you’re likely to come up empty handed. So in API terms, you can’t request data that’s not made available by the API.

What are the different types of API Requests?

Each time you want some information from an API, you send a “Request”.

If you’re working with a developer it pays to know these terms, just so you’re both on the same page.

These different types of requests are called “Methods”.

GET = Retrieve some data

What is included on the burger?

POST = Create some new data

I’d like to place a new order for a burger.

PUT = Update some existing data

I’d like to add pickles to my existing burger order.

What's next?

Next you might want to learn about the format that APIs use to send / receive data - JSON.

How helpful was this doc?


What is JSON?