What are API's?
- API stands for Application Programming Interface
- They are interface's for code/computers to talk to one another.
- Web API's generally communicate via HTTP
Make an HTTP request to an API, and Get Some Data Back!
- 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 requests 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.
- API's use simpler data formats like XML and JSON
XML - Extended Markup Language
- XML is syntacticly similiar 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"
- }
- }