0% found this document useful (0 votes)
64 views

32 Intro To Apis

API's allow different software and applications to communicate with each other by defining interfaces and protocols. Common uses of API's include accessing social media data like tweets and profiles, getting weather or location information, and searching databases like iTunes or Google Places. API's respond with structured data like JSON or XML instead of HTML, and applications make HTTP requests to API endpoints to retrieve this data programmatically.

Uploaded by

Heidi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

32 Intro To Apis

API's allow different software and applications to communicate with each other by defining interfaces and protocols. Common uses of API's include accessing social media data like tweets and profiles, getting weather or location information, and searching databases like iTunes or Google Places. API's respond with structured data like JSON or XML instead of HTML, and applications make HTTP requests to API endpoints to retrieve this data programmatically.

Uploaded by

Heidi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Intro to API's

Connecting with other applications


API
Application Programming Interface

API's are interfaces for code/computers to


talk to one another.

"FB, Talk to me!"


Web API's
Generally communicate via HTTP

Twitter API, give me all tweets that mention "ice cream"


Facebook API, send me the current user's profile picture
Weather API, what is the weather in Missoula Montana?
Reddit API, what is the current top post?
GooglePlaces API, what gas stations are near the user?
Yelp API, give me 10 restaurants in the zipcode 94110
A Human Interface
The itunes API
Make an HTTP request to:
https://itunes.apple.com/search?term=beyonce&entity=musicVideo
Make an HTTP request to an API
Get Some Data Back!

Search for Beyonce Albums


https://itunes.apple.com/search?term=beyonce&entity=album

Search for Beatles Songs


https://itunes.apple.com/search?term=beatles&entity=song

Search for Podcasts About "code"


https://itunes.apple.com/search?term=code&entity=podcast

Search for Harry Potter Movies


https://itunes.apple.com/search?term=harry-potter&entity=movie
Data Formats
When we use the internet, we make HTTP
request and get HTML back.

API's don't respond with HTML. HTML contains


information about the structure of a page. API's
respond with data, not structure.

They use simpler data formats


like XML and JSON
XML
Extended Markup Language

XML is syntacticly similar to HTML, but it does


not describe presentation like HTML does

<person>
<age>21</age>
<name>Travis</name>
<city>Los Angeles</city>
</person>
JSON
Javascript Object Notation
JSON looks exactly like JavaScript objects, but
everything is a string
{
"person": {
"age": "21",
"name": "Travis",
"city": "Los Angeles"
}
}
XML vs. JSON
<person>
<age>21</age>
<name>Travis</name>
<city>Los Angeles</city>
</person>

{
"person": {
"age": "21",
"name": "Travis",
"city": "Los Angeles"
}
}
XML vs. JSON
<person>
<age>21</age>
<name>Travis</name>
<city>Los Angeles</city>
</person>

{
"person": {
"age": "21",
"name": "Travis",
"city": "Los Angeles"
}
}

You might also like