What is an API?

What is an API?


What is an API?

In this video we will see what an API is and how it works!
I will explain you the reason behind using the API as simply as possible.
►Checkout my English channel here:    / programmingwithharry  
►Click here to subscribe -    / @codewithharry  

Best Hindi Videos For Learning Programming:
►Learn Python In One Video -    • Python Tutorial In Hindi 🔥  

►Python Complete Course In Hindi -    • Python Tutorials For Absolute Beginne…  

►C Language Complete Course In Hindi -
   • C Language Tutorials In Hindi  

►JavaScript Complete Course In Hindi -
   • JavaScript Tutorials In Hindi  

►Learn JavaScript in One Video -    • JavaScript Tutorial  

►Learn PHP In One Video -    • Learn Php In One Video In Hindi - हिं…  

►Django Complete Course In Hindi -
   • Python Django Tutorials In Hindi  

►Machine Learning Using Python -    • Machine Learning Tutorials For Beginn…  

►Creating \u0026 Hosting A Website (Tech Blog) Using Python -    • [Hindi] Web Development Using Flask a…  

►Advanced Python Tutorials -    • Intermediate/Advanced python Tutorial…  

►Object Oriented Programming In Python -    • Object Oriented Programming Tutorials…  

►Python Data Science and Big Data Tutorials -    • Python Data Science and Big Data Tuto…  

Follow Me On Social Media
►Website (created using Flask) - http://www.codewithharry.com
►Facebook - https://www.facebook.com/CodeWithHarry
►Instagram - https://www.instagram.com/codewithharry/
►Personal Facebook A/c - https://www.facebook.com/geekyharis
Twitter - https://twitter.com/Haris_Is_Here


Content

0 -> Guys, whenever I used to think about online e-commerce websites, airline ticket booking and food ordering
5.2 -> How these things work?
7.2 -> then there I used to get very surprised upon hearing
10.2 -> that the e-commerce websites
11.7 -> you guys are a seller and you've been given a dashboard
16.2 -> and you people on an e-commerce store such as amazon
20.8 -> can sell anything there
22.7 -> and a lot of customers... what they can do is buy this stock.
28.7 -> and in this customer need to talk to amazon's store.
32.8 -> dashboard is something we say, is given to affiliated marketers
37.7 -> they need to talk to amazon.in's main system.
42.8 -> How is all this possible?
45.2 -> One very good example we have is of airline ticket booking.
48.8 -> There are a lot of third party websites.
50.6 -> One name that comes to my mind is Ixigo, there's via
54.8 -> and then paytm also book flights.
58.2 -> and with that nowadays amazon, flipkart are also joining this line.
63.9 -> So when this happens, that all these players
67.9 -> can talk to different airlines like Indigo or Vistara or GoAir.
75.1 -> It means that these individual companies could fetch no. of seats that are left, that are booked
81.9 -> or if any ticket is booked, they can update in their systems.
84.6 -> Because if a flight of GoAir is booked
88.8 -> So i need to tell GoAir that I'm Flipkart
91.2 -> I have booked one of your seats, so you don't let the same seat get booked from someone else.
95.4 -> So thats why different systems need to talk to and fro with each other.
99.7 -> What will happen in this, if I'm Amazon
102.2 -> and assume that you are Vistara. Would you say that
106.2 -> "Hey amazon, this is my password, do whatever you want in my server"?
109.7 -> This don't happen. Okay
111.6 -> Because me as vistara or as amazon cannot trust the other company directly.
117.8 -> If here I have Amazon, which I don't, but just assume that I have
123.2 -> then I won't trust Indigo, Indigo won't trust me.
127.4 -> And we'll try to communicate in such a way that the trust remain maintained and the work get done.
133.6 -> So this "trust remain maintained and work get done" is carried out by API
139.1 -> What is API?
140.5 -> Full form of API is Application Programming Interface.
144.6 -> Application Programing Interface.
147.4 -> And this API makes it possible for different systems to interact with each other. Okay
154.8 -> So, this third party website.. rather I'd write websites
158.6 -> those by talking to respective airlines, can do to and fro communication
163.4 -> that hey I booked this seat of yours and you gave me this much commision
169.8 -> I booked this much seats of yours and these type of conversations... Communication keeps on going. Okay
174.8 -> So, what is API if I talk about its definition.
177.8 -> So, API is such a mean that helps these systems in exposing some of their data.
185.4 -> So, I'll write API here that whenever Amazon will talk to Indigo,
190.7 -> it will have to talk to API, it can't talk to the system directly.
194.2 -> So, what will happen here is that Amazon will say to Indigo... It will say
198.4 -> that I want to book one of your seats.
200.7 -> I am Amazon. Okay.
202.8 -> it will do it something like... Amazon to tell Indigo that I have booked a seat of yours.
207.8 -> Suppose Indigo folks have given an end point of their website.
210.8 -> They have said that you indigo.com, maybe its goindigo.com.
214.9 -> goindigo.com/makebooking/ put your API key here.
221.6 -> Everybody has their secret key and
223.6 -> This key is to recognize are you the Amazon?
228.8 -> Its not like I go to Indigo and say book 4 seats and they'll book 4 seats.
233.5 -> It will not happen.
235.2 -> You need to hit this end point with proper API key.
238.1 -> and what API will do is it will, first of all, go to the back hand and
242.2 -> check if Amazon has send this request.
245.2 -> If yes, we will book the seats and send the ticket to Amazon.
249.2 -> but if someone is trying to hack into the system or someone is entering wrong API key
253.8 -> then there we'll... Our response will be... We get a request. API got a request.
259 -> Amazon told Indigo, here is my API key and
262.5 -> here is that person's name whose ticket needs to be booked.
265.8 -> Book one ticket from Delhi to Bangalore. Okay
269.2 -> So, Indigo's API will say, stop.
272.2 -> Understand API as something like Indigo is a bungalow, inside the bungalow the owner is sitting.
276.8 -> and API is a security guard.
278.6 -> API will say, STOP! Tell me what is your API key? Show me your API key.
284.7 -> It will match it with its API key. Did we give some API like this to the Amazon?
289.7 -> If yes, okay. Your ticket can be booked.
291.8 -> If not, then it will repulse it away.
295.2 -> It will say invalid credentials. Get Out. Okay
298.7 -> It will say something like this and if it keeps on trying again and again then it'll block it.
302.3 -> There are systems like that too.
304.1 -> So, basically API is an interface that is, it is a way with whose help you can talk to the actual system.
311.1 -> Now, the actual system, that is, Indigo's server
314.8 -> or if they use some distributed computing in the backend.
319.5 -> They cannot give access of all those servers, clusters to Amazon or everyone who are booking through their website.
326.1 -> Its not like Indigo will say "Here's my password, do booking after login." to amazon,flipkart, ixigo, via or paytm.
333.2 -> We are living in a world where people don't reveal there facebook password,
337.1 -> so these business's password is a much bigger deal.
339.2 -> So, what's done here is, everyone is given their own individual API key
344.2 -> and it gets known that who booked how many tickets by sending what requests.
347 -> everything will keep getting locked in their system.
350.1 -> So, the advantage of having API is that, the websites like Flipkart, Paytm, via, Ixigo, all these third party websites,
358.1 -> they don't have to give anything to Indigo
361.8 -> there was no need to give them their credentials.
362.8 -> Just imagine, if Indigo here share all of them its password
367.8 -> and someone would destroy their system
370.8 -> Ixigo would say its Flipkart's fault, Flipkart would say it's amazon's fault,
373.4 -> Amazon would say its Via's fault.
375.1 -> So, to avoid all of this, everyone is given their own individual key.
378.6 -> and they'll login from their API key, they will authenticate.
381.9 -> and after authenticating whatever they want to do, get tickets booked
384.9 -> or other services that they provide...
387.6 -> our airlines like how seats are there, how many window seats are left?
392.4 -> Which seats inside the aircraft are paid and which seats are free?
397.2 -> when did which flight got cancelled.
399.8 -> Different end points are made for all this different information.
403.2 -> and all the information that they should get, that is, these third party websites should get
408.8 -> only that is provided to them. They'll not tell them how much money are they making
413.5 -> or Indigo, Vistara, GoAir, they won't tell, what is their employees data
418.9 -> because what will Amazon, Flipkart, Ixigo, Via and Paytm do about their employees data.
423 -> They will get the information they want and for this they have to...
426.1 -> and for this information they have to send a request along with the API key.
430.8 -> So, they will send a request with their API key and they will get the proper response.
435.3 -> So, whenever there's a need for Amazon, Flipkart, Paytm to talk to Indigo, API acts as a middleman.
440.9 -> API said talk to me, don't talk to them. The owner is resting. Talk to me.
445.1 -> Tell me what you want. Authenticate everything. If its the right person, their work is done
451.1 -> otherwise show them the door. Okay
453.9 -> So this is how API works.
456.1 -> Now food ordering and online e-commerce websites have this type of APIs.
461.5 -> I would like to mention one thing. Its not necessary for an API to always have an API key.
466.8 -> Its not necessary. Some APIs are free.
468.5 -> Suppose I want to expose some data to the public and I have fast enough servers
473.1 -> then I can distribute the data even without an API key.
475.3 -> I'll say, hit a 'get request' on the website and take data. Okay
479.8 -> So, people expose API in this way too.
481.8 -> But in most of the cases, API data is obtained with the help of API key.
486.8 -> You have to authencicate first after that you get the data.
489.8 -> Now we'll look at a very local example. Okay.
492.9 -> What will be that local example?
494.8 -> Suppose you guys go to a restaurant to eat food and assume I'm the owner there.
500.8 -> Just assume it. What's the harm in assuming?
503.3 -> And here I feed you delicious Palak Paneer.
507.8 -> And you come here and I'm sitting here on the counter. This is me sitting here. Okay.
512.8 -> And suppose this is where the food is cooked. Here our chef's are sitting. Okay.
516.4 -> And this is our waiter. Okay.
518.6 -> So this waiter will ask you what food you want to eat?
521 -> This waiter will ask you .
523 -> You won't directly come into the kitchen and tell that you want to eat Palak Paneer.
527 -> or barge into my office and tell me that you want to eat Palak Paneer.
530.1 -> You won't do it yourself. Assume this as API.
532.6 -> Assume this waiter as API. This waiter is an API.
534.6 -> You approach him first and tell him to bring me one Palak Paneer, one roti, one Paneer Masala.
539.1 -> Whatever you want to eat... Chowmein,omlette.
542 -> Whatever you want to eat, you tell him and he notes all that.
544.8 -> He says,'good' X 4. Then he goes into the kitchen.
547 -> Sometimes he comes back and say, Sir Palak Paneer is not available, Sorry.
551.8 -> This is how API also returns its request.
553.8 -> You give a request to the API, sometimes API can deny you too.
557.6 -> It can say that you only had to hit me 40 times during a day,
562.2 -> and you are hitting me for the 41st time.
564.8 -> That's why you won't get the data. Sometimes, you get these types of responses from the API too.
568.8 -> So, who is the actual system? Actual system is the chef who is cooking the food.
574.1 -> and who is API? API is this waiter
576.8 -> who is taking in requests from you. Asking what do you want?
579.6 -> It wrote down the order. Now it goes inside and tell who...
584.8 -> she goes and tells the chef and if food is available
588.6 -> our chef sir will tell you that food is available, its cooking.
591.2 -> Sometimes you send a request to the waiter... you ask 'Food isn't prepared yet?'
594.8 -> Waiter tells you that its being cooked, wait a bit.
596.6 -> So, this is also a type of response.
597.8 -> You interact with an API and give it a request and its gives you back the response.
603.6 -> If I summarize all this, then I'll say
606.2 -> API is used so that the access to the actual system is not given to someone else.
611.8 -> We made an API and whoever wants some data of our system,
617.9 -> we'll expose those API to them, give them end points with proper API key
623 -> And with the help of this API key, we'll monitor who accessed how much data from our server.
628.2 -> API keys in most of the cases are documentations.
631.1 -> API keys are docs in which all information is written on how to use and rules.
638.1 -> How many times you can hit the API,
641.1 -> how many times you can send more request after extracting data.
645.1 -> What data can you extract from the API?
648.2 -> All this is written in documentation in most of the cases.
650.8 -> If I take one example of an API, it is news API that I taught you in Java Script course probably.
656.8 -> In that we made an app that extract all the news from a website with the help of a news API.
663 -> There was an API key too.
664.7 -> Now the Times of India folks... they don't want to give you the access to the whole server's database.
671.4 -> They cannot afford this. If you do something wrong there, they might get in a lot of trouble.
676.8 -> That's why they give you an API, oh okay, you want this, you take its API.
681.9 -> and after that if you want more data, send them another request.
686.2 -> So in this way for monitoring...
688 -> With this, APIs are used to safely handle the data.
693.9 -> It also lets you know who is using how much of data?
696.9 -> and with this your monitoring,that is,how much your actual system is being used and by whom.
702.2 -> All this is also done very well. I hope you guys understood API.
705.9 -> If you have understood, start using APIs.
710 -> I have taught you to use a lot of APIs
712.4 -> for example our news API. There's weather API.
715.2 -> So learn to access these types of APIs.
718.8 -> I have put on my web development, java script course. I would tell you that after this video
723.7 -> you go... if you are a web developer, you can checkout my web development course. Checkout my Javascript course.
729.1 -> We have seen a lot of APIs there. I hope you all liked this video.
733.2 -> Thank you so much for watching this video and I will see you next time.

Source: https://www.youtube.com/watch?v=E0Qqpn8ymko