eli5: What is the difference between a Protocol and API?

198 views

eli5: What is the difference between a Protocol and API?

In: 0

2 Answers

Anonymous 0 Comments

An API is a set of functions that an application exposes to other applications.

A protocol describes the mechanism by which those applications communicate.

An API will often specify the protocol(s) required to interact with the system. For example a website might say, this is our API, you can call this getWeather method to request the current weather for the city provided. But the documentation will also say, this is a REST API, you must use the Hyper Text Transfer Protocol to send requests. And if you don’t know what that is, you need to refer to the HTTP specification to know how to structure your requests, and what responses to expect.

You are viewing 1 out of 2 answers, click here to view all answers.