Introduction to APIs

An API, or Application Program Interface, is a set of rules that make it possible for applications to interact with each other and share data.

It’s like ordering food at a restaurant

endpoint

What does it mean?

  • Find the current location of the International Space Station

 

  • Find restaurants near my current location

 

  • Predict global weather conditions

 

  • Post photos to Instagram

Where’s the ISS?

HTTP Requests

POST

Creates a resource

GET

Retrieves a resource

GET

GET http://google.com

GET http://wikipedia.com

GET http://facebook.com

API Parameters

Additional information passed through a URL. This can be used to authenticate a request, or customize the server’s response.

Foursquare

https://api.foursquare.com/v2/venues/search?ll=40.6612333,-73.98995479999999&

v=20150518

GET 

Authentication

Most API providers require basic authentication. 

Foursquare

https://api.foursquare.com/v2/venues/search?

ll=40.6612333,-73.98995479999999&

v=20150518&

client_id=IN4V05KYYXLPDXGIHMCDSPVIAG30BTOG4NC3AEAYFYIQZID0&

client_secret=CD31L2IZKSYQ1AAGTHQQEF2GHXJLI43CXYV1KVCEEUQZQ2G4

 

Foursquare

https://api.foursquare.com/v2/venues/search?

ll=40.6612333,-73.98995479999999&

v=20150518&

client_id=IN4V05KYYXLPDXGIHMCDSPVIAG30BTOG4NC3AEAYFYIQZID0&

client_secret=CD31L2IZKSYQ1AAGTHQQEF2GHXJLI43CXYV1KVCEEUQZQ2G4

 

query string

Weather forecast

IFTTT

Made with Slides.com