STOR 390: APIs Marshall Markham Overview Intro to APIs Concept - - PowerPoint PPT Presentation

stor 390 apis
SMART_READER_LITE
LIVE PREVIEW

STOR 390: APIs Marshall Markham Overview Intro to APIs Concept - - PowerPoint PPT Presentation

STOR 390: APIs Marshall Markham Overview Intro to APIs Concept Steps to URI API Usage Google Maps Exercise What is an API API stands for Application Programming Interface Any body of code meant to be used by outside


slide-1
SLIDE 1

STOR 390: APIs

Marshall Markham

slide-2
SLIDE 2

Overview

  • Intro to APIs Concept
  • Steps to URI API Usage
  • Google Maps Exercise
slide-3
SLIDE 3

What is an API

  • API stands for Application Programming

Interface

  • Any body of code meant to be used by outside

programmers represents an API

  • Web and Rest APIs
  • URI APIs
slide-4
SLIDE 4

Steps to URI API Usage

  • 1. Recognize the problem may be solved by the

use of an API

  • 2. Read the docs
  • 3. Sign up for access
  • 4. Request sample data and review
  • 5. Write formatting functions against the

sample data

  • 6. Get the full dataset
slide-5
SLIDE 5

Google Maps API Example

Q: Suppose we are working for a company that has three datasets relating addresses to latitude, longitude coordinates and want to determine the most accurate. What do we do? A: Geocoding

slide-6
SLIDE 6

Step 1

  • Identify the problem requires data and search

for an online source.

slide-7
SLIDE 7

Step 2

  • Read the docs to determine how to interact

with the API

  • Simply google “Google Geocoding

Documentation” and start digging

slide-8
SLIDE 8

Question 1

Q: What is an example geocoding request from google maps geocoding API? The answer may be found under “Sample Request and Response” at : https://developers.google.com/maps/document ation/geocoding/start

slide-9
SLIDE 9

Step 3

  • Google requires that we have a key provided

by them in order to use their geocoding service

  • Please sign up for an API key now
slide-10
SLIDE 10

Question 2

  • Use the api key just obtained to submit the

example http query to google maps

  • Use use your web browser to conduct this

exercise

  • What was the place_id field in the response?
slide-11
SLIDE 11

Step 4

  • Write code to turn the data you have into URI

strings

  • Submit the code requesting 10 to 100 results
  • Review the results and consider whether the

appropriate information is contained

slide-12
SLIDE 12

Step 5

  • Write code to transform the data you received

in the example request

  • Break the problem out into pieces and write

them in individual functions

  • This is generally easier than trying to tackle

the entire problem at once

slide-13
SLIDE 13

Step 6

  • Test the request code and the result

transformation code on one more 10

  • bservation chunk
  • Pull a full request and parse it into the

required dataset

  • Store the dataset
slide-14
SLIDE 14

Creating Sub-problems

  • In general, when confronted with a

programming problem it is good to frame the larger problem as a set of manageable sub problems.

slide-15
SLIDE 15

Review of Steps

  • 1. Recognize the problem may be solved by the

use of an API

  • 2. Read the docs
  • 3. Sign up for access
  • 4. Request sample data and review
  • 5. Write formatting functions against the

sample data

  • 6. Get the full dataset