Introduction

️✅ Learning objectives

  • Explain what an API is.
  • Decide whether this book is for you.

What is an API?

API = “application programming interface”

  • “application” = function, website… any computerized thing
  • “programming” = can be used in code
  • “interface” = way to interact with something

🤖 APIs allow computers to talk to one another

What are web APIs?

💻 Technically any function’s list of arguments is an API

“httr2 is a ground-up rewrite of httr that provides a pipeable API with an explicit request object that solves more problems felt by packages that wrap APIs” (httr2 docs, emphasis added)

🕸️ This book = web APIs

  • Web API = API on the internet
  • For rest of book, “API” means “web API”

What are some API examples?

What will I learn?

  • Part 1: How can I get web data into R? ({httr2})
  • Part 2: How can I create my own APIs with R? ({plumber})

What does each chapter cover?

Part 1: How can I get web data into R?

  • How can I access APIs from R?
  • How do I tell the API who I am?
  • How can I process API responses?
  • How can I get a lot of data from an API?
  • How can I find APIs?
  • How can I find API-wrapping packages?
  • How else can I communicate with APIs from R?
  • How can I get data from web pages?
  • How can I learn more about accessing web APIs?

Part 2: How can I create my own APIs with R?

  • How can I create an API?
  • How can I get inputs from API users?
  • How can I control API output?
  • How can I handle API errors?
  • How can I authenticate API users?
  • How can I test my plumber API?
  • How do I deploy my plumber API?
  • How can I learn more about creating APIs?

What won’t I learn?

Who should read this book?

  • Data Analysts/Scientists
    • Part 1: Enrich datasets
  • Machine Learning Engineers
    • Part 1: Feature engineering
    • Part 2: Share predictions
  • Data Producers (Researchers, etc)
    • Part 2: Share data
  • Shiny App Designers
    • Part 1: Load/process data
    • Part 2: Divide & conquer

Prerequisites

  • Very few hard prerequisites
    • Will point to resources when helpful
  • I assume familiarity with R
  • Helpful:

How are chapters structured?

  • Learning Objectives ≈ skills
    • “After you read this chapter, you will be able to…”
    • There will be a separate index of these
  • Test-Yourself Questions to check understanding
  • Check online version for API updates
  • (TODO: Anything to note about code vs text?)
  • (TODO: Probably an over-arching case study of an election data Shiny app?)

What do you think?

Please complete this survey!