1. Introduction to API's | Full tutorial for beginners | Learn API concepts |

#Udemy Courses
27 Apr 201915:42

Summary

TLDRThis video explores the exciting world of APIs, emphasizing their role in connecting applications and enhancing possibilities for developers. It covers the basics of APIs, their broad applications in various services like Facebook, Twitter, and Google Maps, and introduces the concept of web APIs. The speaker also highlights the potential of combining APIs for innovative projects and mentions the Internet of Things, showcasing how physical objects can be controlled via APIs.

Takeaways

  • 😀 APIs (Application Programming Interfaces) are essential tools that allow different applications to communicate and share data.
  • 🌟 The speaker's enthusiasm for teaching about APIs stems from their ability to open up endless possibilities for building applications that leverage existing data and services.
  • 🔌 APIs enable developers to 'stand on the shoulders of giants' by using existing services and data instead of creating everything from scratch.
  • 📍 Examples of APIs include those for maps, weather data, and social media platforms like Facebook, which can be used to enhance applications without the need for extensive groundwork.
  • 🔑 The term 'API' can refer to any interface that allows code to interact with other code, including web-based APIs and those for databases, hardware, or software libraries.
  • 📚 The textbook definition of an API includes a set of routines, protocols, and tools for building software and applications, highlighting its broad applicability.
  • 🌐 Web APIs specifically are interfaces that allow applications to communicate over the internet, often using HTTP requests to retrieve data in a structured format like JSON.
  • 🔍 Popular web APIs mentioned include those from Twitter, Facebook, Reddit, Google Places, and Yelp, each serving different purposes and providing access to unique datasets.
  • 🛠 'If This Then That' (IFTTT) is a service that allows users to connect different APIs in a visual interface to automate tasks and create custom interactions between services.
  • 🚗 The Internet of Things (IoT) introduces APIs for physical objects, such as smart light bulbs or Tesla cars, enabling them to be controlled and interacted with via code.
  • 🗺 Programmable Web is a directory that lists thousands of APIs, serving as a valuable resource for developers looking for specific data sources or services to integrate into their applications.

Q & A

  • What is an API?

    -An API, or Application Programming Interface, is a set of routines, protocols, and tools for building software and applications. It allows different software programs to communicate with each other.

  • Why are APIs exciting to learn about?

    -APIs are exciting because they open up possibilities for building applications by utilizing data and services from other applications, allowing developers to create complex systems without having to develop everything from scratch.

  • Can you give an example of how an API is used in a real-world application?

    -A common example is the use of the Facebook API by the Tinder app. Tinder uses the Facebook API to fetch user data like profile pictures, likes, and mutual friends to enhance the dating experience by matching users with similar interests.

  • What does the term 'web API' specifically refer to?

    -A web API is a subset of APIs that facilitate interaction with web-based systems over the internet. It allows applications to send and receive data from web services using standard protocols like HTTP.

  • What format is commonly used for data exchange in web APIs?

    -JSON (JavaScript Object Notation) is a common format used for data exchange in web APIs because it is lightweight and easy for both humans and machines to read and write.

  • What is the purpose of the website 'Programmable Web' mentioned in the script?

    -'Programmable Web' is a directory that lists and categorizes APIs. It provides information on various APIs available for different services, helping developers find and integrate the APIs they need.

  • What is 'If This Then That' (IFTTT) and how does it relate to APIs?

    -IFTTT is a service that allows users to create chains of simple conditional statements, called 'recipes,' to automate actions between different apps and devices. It relies on APIs to connect and control these services and devices.

  • Can APIs be used to interact with physical devices? Provide an example.

    -Yes, APIs can interact with physical devices, often referred to as the 'Internet of Things.' An example is the Tesla API, which allows users to control various aspects of their Tesla cars, such as checking battery status, setting climate control, or even honking the horn.

  • What are some of the applications or data that can be accessed through APIs mentioned in the script?

    -Examples include Facebook profile data, Twitter tweets, weather data, Reddit posts, Google Maps locations, and Yelp restaurant information. These APIs allow developers to integrate various functionalities into their applications.

  • Why is understanding APIs beneficial for developers?

    -Understanding APIs is beneficial for developers because it enables them to leverage existing services and data, speeding up development time and enhancing the functionality of their applications by integrating diverse data sources and capabilities.

Outlines

00:00

🎓 Introduction to APIs and Their Importance

The speaker introduces APIs, emphasizing their potential to expand what can be built by using data from other applications. APIs allow developers to leverage existing data and services, making it easier to create powerful applications without starting from scratch. The concept of APIs is explained, highlighting that they enable communication between programs and services.

05:00

🌐 Understanding Web APIs

The focus shifts to web APIs, which allow applications to communicate over the internet. Examples such as Facebook's API, which Tinder uses to access user data, illustrate how APIs function. The speaker explains the difference between human interfaces (e.g., HTML) and programmatic interfaces (e.g., JSON), which are used by applications to exchange data efficiently.

10:01

🔗 Examples of Popular APIs

The speaker provides examples of popular APIs, including those from Twitter, Facebook, Reddit, Google Maps, and Yelp. The utility of combining multiple APIs to create more advanced applications is highlighted. The website IFTTT.com (If This Then That) is introduced as a tool to connect different APIs for various automation tasks.

15:02

🚀 Exploring API Directories and Specific Use Cases

The speaker discusses programmableweb.com, a directory of over 15,000 APIs, showcasing the wide range of available APIs for different purposes. The Tesla API is mentioned as an example of an Internet of Things (IoT) API, allowing users to control various functions of their Tesla vehicles programmatically. This demonstrates the practical applications and innovative possibilities of APIs.

📚 Summary and Importance of APIs

The video concludes by summarizing the key points about APIs, defining them as tools that allow code to interact with other code or services. While most people refer to web APIs when talking about APIs, the term encompasses a wide range of interfaces used in various applications and services. The speaker underscores the significance of APIs in modern software development.

Mindmap

Keywords

💡APIs

APIs, or Application Programming Interfaces, are a set of routines, protocols, and tools for building software applications. They allow different software systems to communicate with each other. In the video, APIs are highlighted as a key to creating innovative applications by leveraging data from other services, such as social media platforms or weather services, without having to develop everything from scratch.

💡Web API

A Web API is a type of API that is accessed over the internet. It is a more specific subset of APIs that allows for communication between web-based applications. The video discusses how web APIs are used to request data from services like Facebook, Reddit, and Twitter, which is then integrated into other applications to provide additional functionality.

💡JSON

JSON, or JavaScript Object Notation, is a lightweight data-interchange format that is easy for humans to read and write and for machines to parse and generate. In the context of the video, JSON is mentioned as the format in which data is often returned by web APIs, making it a crucial component for developers when consuming API responses.

💡IFTTT

IFTTT, which stands for 'If This Then That', is a service that allows users to create chains of simple conditional statements, called 'applets', which are triggered based on changes to other web services. The video uses IFTTT as an example of how APIs can be connected to automate tasks across different services.

💡Internet of Things (IoT)

The Internet of Things refers to the network of physical devices, vehicles, and other items embedded with sensors, software, and connectivity that enables these objects to collect and exchange data. The video mentions IoT in the context of APIs controlling physical objects like smart light bulbs or Tesla cars, showcasing the broad application of APIs.

💡Data Interchange

Data interchange is the process of sharing data between different systems. APIs facilitate data interchange by providing a standardized way for applications to request and receive information. The video emphasizes the importance of APIs in enabling data interchange for creating rich, data-driven applications.

💡HTTP Requests

HTTP, or Hypertext Transfer Protocol, is the primary protocol used for communication on the World Wide Web. In the video, HTTP requests are mentioned as the means by which web APIs are accessed, allowing developers to retrieve data from remote servers.

💡Facebook API

The Facebook API allows developers to access and utilize Facebook's data and functionalities within their own applications. The video uses the Facebook API as an example to illustrate how an application like Tinder can access common interests and mutual friends data to enhance its service.

💡ProgrammableWeb

ProgrammableWeb is an online directory that provides information about various APIs. It serves as a valuable resource for developers looking to find and understand different APIs for their projects. The video mentions ProgrammableWeb as a place to discover and explore a wide range of APIs.

💡Endpoints

In the context of APIs, an endpoint refers to a specific URL that is used to request a particular resource or service. The video explains that endpoints are part of API documentation, which provides information on how to interact with the API and what data to expect in response.

💡Tinder

Tinder is a dating application that uses the Facebook API to access user data, such as profile pictures and interests, to facilitate the matching process. The video uses Tinder as an example of an application that relies on an API to function effectively and provide a personalized user experience.

Highlights

APIs open up possibilities for building applications by using data from other applications.

API stands for Application Programming Interface, which is a way for programs to communicate.

Tinder uses Facebook's API to show common likes and mutual friends.

APIs can be used for various purposes like accessing weather data, maps, and social media feeds.

IFTTT (If This Then That) connects different APIs to automate tasks.

Programmable Web is a directory with over 15,000 APIs for various uses.

APIs can be used for controlling physical objects like thermostats and light bulbs through the Internet of Things.

Tesla has an unofficial API that allows interaction with their electric cars, such as checking battery charge and controlling climate settings.

APIs can be used to automate social media posts across multiple platforms using IFTTT.

Web APIs are a subset of APIs that specifically deal with web interfaces and HTTP requests.

JSON is a data format that is easier for computers to use, commonly used in web APIs.

APIs can be used to create applications that display live data, such as a chart updating with the number of dog and cat mentions on Reddit.

APIs can be used to access and manipulate data from databases, video cards, and hard drives.

APIs can be used to create applications that interact with social media platforms like Twitter and Facebook.

APIs can be used to access and utilize data from services like Google Places and Yelp for location-based applications.

APIs can be used to create applications that automate tasks based on certain triggers, such as turning off Wi-Fi when leaving a specific location.

Programmable Web is a great resource for finding APIs for specific projects or for inspiration.

Transcripts

play00:00

all right welcome back so this topic

play00:03

this section that we're going to talk

play00:04

about is one of my favorite things to

play00:07

teach it's really really fun for me and

play00:09

I know I say that a few times in this

play00:11

course but this is by far the actual

play00:14

favorite topic of mine and it's really

play00:18

exciting to learn in my opinion we're

play00:20

going to talk about api's and the reason

play00:22

that it's exciting to learn is that it

play00:24

really opens up the possibilities for

play00:26

what you can build you can make all

play00:30

sorts of amazing applications that use

play00:32

data from other applications or that

play00:34

rely on other applications to basically

play00:36

you know you can stand on the shoulders

play00:39

of giants and and make some really

play00:41

awesome things without having to do a

play00:42

ton of work and do everything yourself

play00:44

from scratch so the subtitle is

play00:47

connecting with other apps and that's

play00:50

really the gist of all of this is what

play00:53

if we want to display a map or I want to

play00:54

get latitude longitude data or I want to

play00:57

get weather data you don't need to go

play00:59

put out weather sensors and connect them

play01:02

to the Internet and then get that data

play01:03

someone else has done that and made it

play01:07

all nice and easy for you to understand

play01:08

and interact with and then you just

play01:10

write code that uses that API so without

play01:13

getting too far ahead of ourselves

play01:14

API stands for application programming

play01:17

interface although it's actually

play01:19

application program interface

play01:21

some people say programming it doesn't

play01:23

matter but the idea is that it's an

play01:25

interface for programs for code or

play01:28

computers to talk to one another so I

play01:30

can write code like this code it's very

play01:33

small but this code right here is

play01:35

interacting with Facebook so Facebook

play01:38

has an API that allows me to get data

play01:40

from Facebook so we have it you know

play01:43

human interface when I go on Facebook

play01:45

myself and hopefully I don't spend too

play01:47

much time there but when I do that I'm

play01:49

looking at the human interface the HTML

play01:51

usually that I see it's rendered to me

play01:54

nicely they got photos and colors and

play01:56

text and fonts and all that stuff

play01:59

when I want to make an app though that

play02:01

uses Facebook data so a popular example

play02:04

would be something like tinder if you're

play02:06

not familiar with tinder

play02:08

you're probably lying but if you're

play02:11

actually not familiar with

play02:12

it's a dating ish application that you

play02:16

go on you sign up with your Facebook

play02:18

account and it shows you people's photos

play02:20

you can kind of say yes or no swipe left

play02:23

or right but most importantly to what

play02:25

I'm talking about here is that it shows

play02:27

you if you have any likes in common with

play02:30

them so if you have any favorite movies

play02:32

that you've added to both of your

play02:34

Facebook profiles or books or I think

play02:38

music as well and a few other things and

play02:40

it also will tell you how many friends

play02:42

you have in common

play02:43

based off of Facebook so that data is

play02:46

not just coming from the regular

play02:47

Facebook website like if I went on

play02:50

Facebook I could find that out if I

play02:51

matched with someone I could go on their

play02:53

Facebook page if it's public at least

play02:55

and I could manually compare do we like

play02:59

the same movies but of course that's not

play03:01

happening behind the scenes and tinder

play03:03

source code there is code that's

play03:05

connecting to Facebook's API and saying

play03:07

hey these two people well it's probably

play03:11

more like hey this person that called

play03:13

has matched with let's get their data

play03:16

and save it to our database and then

play03:18

let's take colds data that we already

play03:19

have in our database and compare them

play03:21

but the idea is we're talking or tinder

play03:23

is talking to Facebook and that's one

play03:26

example but api's are literally

play03:29

everywhere nowadays pretty much every

play03:31

application you use so the term API is

play03:35

actually a broader term that refers to

play03:38

any type of code any interface that is

play03:42

made for other code to communicate with

play03:44

so if we go on Wikipedia actually the

play03:48

definition the textbook definition I

play03:50

guess is in computer programming an

play03:52

application programming interface of so

play03:54

if they use programming that program is

play03:56

a set of routines protocols and tools

play03:58

for building software and applications

play04:00

so that's very broad and that is

play04:02

basically saying it's any set of tools

play04:05

code

play04:06

routines that you can use in an

play04:09

application so it could be a database

play04:13

API so that has nothing to do with the

play04:15

internet it's just how you connect to a

play04:17

database locally on your computer it

play04:19

could be a video card API or a hard

play04:22

drive a hard disk drive API

play04:24

so those are kind of other non web-based

play04:27

examples or when I was learning Java in

play04:30

high school I used an API to to

play04:34

incorporate like graphical elements

play04:36

buttons and windows and stuff into my

play04:38

applications really ugly mario clone

play04:41

that i made and like solitaire i used an

play04:44

api for that so that is a different kind

play04:46

of context typically what people mean

play04:49

when they refer to an api today is a web

play04:52

api which has its own section here but

play04:55

that is a subset of api's in general so

play04:57

api is in general any code whether it's

play05:00

a library a package a module a web api

play05:03

some sort of interface to work with

play05:06

image analysis on your computer or a

play05:09

database they're all over the place

play05:11

so many different things that they do

play05:13

you can use them in your own code web

play05:17

api s are more specialized they have to

play05:19

do with web interfaces to other code or

play05:24

to other applications so for instance

play05:27

the Facebook API we talked about the way

play05:29

that an application gets that data is

play05:31

through the web through the internet I

play05:34

am requesting that data from Facebook so

play05:37

just like when I request a web page

play05:39

let's say reddit.com slash are slash aw

play05:42

which is cute photos they're cute images

play05:45

of dogs and cats usually with the

play05:47

occasional reptile lover slash weirdo no

play05:52

offense to anyone who has reptiles

play05:53

I just can't can't get behind that so

play05:56

when I request this hit enter you know

play05:59

I'm seeing the human version the

play06:00

interface for me and for all of us but

play06:03

there's also an interface for codes to

play06:06

interact with there's a web api where we

play06:08

request it and rather than seeing this

play06:10

our computer sees this so I'll talk

play06:14

about what this is it's something called

play06:15

JSON and just a one video from now but

play06:18

it's basically another format of data

play06:21

that is better easier for computers to

play06:24

use it doesn't have any of the fluff

play06:25

that we have here because if I'm writing

play06:28

an app let's say I want to pit dogs

play06:31

versus cats and I want to count the

play06:33

number of posts every day that mentioned

play06:35

dogs and the number of posts every day

play06:37

that mention cat

play06:38

and have a chart so you can visit my

play06:40

website and there's a live chart that's

play06:41

updating what I would need to do is get

play06:44

that from reddit I would need to ask

play06:45

reddit you know give me the data today

play06:48

or every hour that updated give me the

play06:51

current front page of our /oo and then I

play06:54

would go through the data this data here

play06:56

and calculate you know search for dog

play06:59

search for cat and tally it up and

play07:01

update my graph every hour so that's a

play07:03

simple example you can do much more

play07:06

complex things of course so here are

play07:09

some other examples of api's twitter you

play07:12

can do things like give me all the

play07:14

tweets that mention ice cream or you

play07:16

know unlike CNN there's always like live

play07:19

tweets coming in that mentioned certain

play07:21

hashtags or certain news events Facebook

play07:24

as we talked about so many things you

play07:26

can get from Facebook's API profile

play07:29

pictures likes and that and you probably

play07:32

see it all the time in applications

play07:34

where you see that kind of warning or

play07:37

question that pops up from Facebook it's

play07:39

like this application wants to use your

play07:42

data do you accept it or not or do you

play07:44

permit it or not and you can kind of

play07:46

change things who can see what and what

play07:48

data it can access whether API so

play07:51

there's lots of weather API is out there

play07:53

they do different things reddit API kind

play07:56

of what we just saw very briefly Google

play07:59

Places what gas stations are near

play08:02

someone Google Maps of course to get a

play08:04

map going the Yelp API you can do things

play08:07

like give me ten restaurants in not the

play08:10

zip code 94110 lots and lots of things

play08:13

you can do and then of course by

play08:15

combining them together you can do even

play08:17

cooler things which is actually this

play08:20

site ifttt.com if this then that is a

play08:25

way to connect api's so there are three

play08:29

hundred and nine services and basically

play08:32

this is it's kind of confusing I guess

play08:34

but it's a way to have a visual

play08:37

interface to connect api's to do things

play08:40

for you so I picked up photography on

play08:43

the side and there's so many photography

play08:46

sites if you want to do the whole social

play08:47

media thing and there's Flickr and

play08:50

Instagram Facebook 500 pixels Dropbox

play08:55

and I want an iCloud and let's say I

play08:58

want all of those anytime I post a photo

play09:00

to Instagram I want it to post to all of

play09:02

those other places you can do that

play09:04

using if this then that so these are all

play09:07

the services they they allow they work

play09:09

with so Facebook's API Twitter's API

play09:11

github x' there are something there's

play09:15

something called the Internet of Things

play09:16

so ap is that will exist for physical

play09:19

objects like a thermostat where you can

play09:23

control the temperature through an API

play09:24

or a video camera security camera where

play09:28

you can use code to turn it on and off

play09:30

or rotate it or a light bulb that you

play09:34

can change the hue the color of

play09:35

dynamically using code so you know in

play09:38

college had friends who would take light

play09:40

bulbs that were smart electronic ones

play09:43

connected to the internet plug them into

play09:45

their dorm and then it would

play09:47

automatically take whatever music was

play09:49

playing they wrote some code that would

play09:51

then kind of turn the lights on and off

play09:52

and change the color to make a little

play09:54

visualizer for the music so there's tons

play09:59

of thing of things on here this is just

play10:01

a side thing that's cool for you to

play10:02

check out if this than that if you're

play10:04

not familiar with it you can look at

play10:07

browse recipes so these are some of the

play10:09

popular things people will do like

play10:13

remind yourself to put on sunscreen when

play10:15

the UV index is high so it will

play10:19

automatically connect to an API that

play10:20

figures out what the UV index is and

play10:23

then it will write some code that you

play10:26

know whatever I don't know what the UV

play10:27

index how that works what the scale is

play10:29

but whenever it reaches a certain number

play10:31

then it will send you an alert receive a

play10:37

notification to turn off Wi-Fi and save

play10:38

battery powder when you leave a specific

play10:40

location so you can do all sorts of

play10:43

things connect you know if this then do

play10:45

that all right so that all relies on the

play10:47

API is and they support 300-plus api's

play10:51

but there are way more api's out there

play10:53

and a great place to see that is a tool

play10:56

or a site called programmable web and

play10:58

it's an API directories how they build

play11:01

themselves

play11:02

have 15,000 api's there are more out

play11:06

there but this is a great place to start

play11:07

so if I know I want to use

play11:10

transportation data let's say I want to

play11:14

make an app that will tell you when the

play11:18

next train is in San Francisco using

play11:21

your current location or will tell you

play11:24

what the latest train you can take to

play11:26

still make it to work before your first

play11:27

meeting is something like that I would

play11:29

need an API to figure out when the

play11:31

trains are so I could click on

play11:33

transportation here I could do a search

play11:35

and there's all these different API so

play11:38

there's a yahoo traffic there's a bus

play11:41

lufthansa for narrow lines there's

play11:44

Indian Railways so this is kind of all

play11:46

over the place you could narrow it down

play11:48

of course or you could look for weather

play11:52

if I needed weather data and there's all

play11:54

these api's you can click on one like

play11:57

let's go I don't want those interesting

play12:01

climbing weather provides weather data

play12:04

for climbing sites and then I can see

play12:06

the URL for their home page sometimes

play12:10

their sample code not always in this

play12:14

case there isn't I can see the sites

play12:16

they support the climbing sites and then

play12:19

I can also see an endpoint that will

play12:23

show you basically this is the site

play12:25

where you can go learn about how the API

play12:28

works so we're gonna see this in just a

play12:30

moment with one the API is we

play12:32

incorporate but this will tell you the

play12:34

documentation what the data looks like

play12:36

that you'll get back where you're

play12:38

supposed to make a request to to find

play12:39

certain data so that's all I want to

play12:43

show though mainly programmable web so

play12:45

the directory for lots of api's some

play12:48

amazing things on here some sort of

play12:50

obscure things api is to detect nudity

play12:54

and images and then more common things

play12:57

like you know restaurants and bars and

play12:59

location guides national park data

play13:03

linkedin data maps Facebook you know

play13:06

lots and lots of things on here so great

play13:09

resource also fun just to browse some

play13:12

things that they have on here if you

play13:13

ever you know a lot of times I would get

play13:15

student's a project and and some people

play13:18

know immediately they want to use a

play13:19

certain API and then some people weren't

play13:21

inspired and they needed help they

play13:23

wanted inspiration and they just go

play13:24

browse until they find an API that

play13:26

excites them often on programmable web

play13:29

ok so one last thing here that I just

play13:32

think is cool is that Tesla Tesla cars

play13:35

or motor cars the electric car maker has

play13:38

an API

play13:40

I think it's unofficial that they don't

play13:42

support it necessarily but there's an

play13:44

API that you can use to interact with

play13:46

their cars so you can view the

play13:50

documentation here of things you can do

play13:52

you can query a car for how charged it

play13:56

is what percent of the of the battery is

play13:58

charged how much the estimated range and

play14:01

this is what you get back so when you

play14:03

make a request to this URL and you have

play14:07

to put in your vehicle ID and I don't

play14:09

have a Tesla so I won't do that but if

play14:11

you did you could put it in there and

play14:13

plug it in the red and it would give you

play14:15

this information but you can also do

play14:17

things like ask for the current climate

play14:19

settings temperature inside temperature

play14:22

outside and then you can do really fun

play14:25

things like wake the car up or open the

play14:28

charging port on the on the side start

play14:32

the charging stop charging flash the

play14:33

lights honk the horn so you can write

play14:36

code that will there's videos of people

play14:39

who do this they'll have when their

play14:41

alarm goes off in the morning code will

play14:44

automatically check the weather outside

play14:45

and then appropriately set the Tesla

play14:48

well turn the Tesla on first set its

play14:51

temperature inside to an appropriate

play14:53

temperature depending on how hot or cold

play14:54

it is outside then it will honk the horn

play14:57

and start some music that will you know

play15:00

wake up music or something and there's

play15:01

videos to this online and you can do

play15:03

that because of the API so that's an

play15:06

example of you know the Internet of

play15:08

Things where there's a physical object a

play15:11

thing that is being controlled through

play15:13

an API ok so we covered a lot there to

play15:18

sum up api's application programming

play15:20

interface ways for you to write code

play15:24

that interacts with other code other

play15:26

pieces of data application services

play15:29

typically web api is what most people

play15:32

refer to which are api's that are

play15:34

structured in a way that you interact

play15:37

with them through the web usually

play15:40

through HTTP requests

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
APIsApplicationDataIntegrationWeb ServicesProgrammingInnovationDevelopmentInternet of ThingsIoT
Benötigen Sie eine Zusammenfassung auf Englisch?