简体   繁体   中英

What is the difference between Application Program Interface and Uniform Resource Locator?

What is the difference between Application Program Interface and Uniform Resource Locator? Please explain it in simple words, since I am still a beginner in web development.

Let's say that you have a friend you want to talk to.

An application programming interface (API) is basically just a way for two different pieces of software to talk to each other.

One API we have in real life is traditional postal mail. You can send a request to your friend by writing it on a piece of paper, putting it in the correct packaging/format, properly addressing the letter, and affixing the required payment.

Your friend will receive the request if it follows all the requirements for sending mail. If it doesn't follow those requirements, the letter will end up somewhere else or potentially nowhere at all.

Once your friend gets the request, he has several options. If he doesn't want to talk to you, he can just sit on the request and wait. If he really hates you, he can get a restraining order to make it forbidden. If he is in a mood to grant your request and if he is convinced the request is truly from you (usually using a token Or key in the case of an API), he will send what you request back in reply.

That letter is fundamentally a real life API.

A uniform resource locator is where exactly your friend lives. Think of it as the address for his house. You can go there and visit him, but that's time consuming and his parents may not like you, which is why you have the API/mail as your agreed upon way to communicate.

The API is the postal system. The URL is where your friend lives.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM