httr is an R package that provides a user-friendly wrapper around the curl package for working with HTTP and web APIs. It’s now superseded by httr2, which is recommended for new projects.
The package simplifies HTTP requests with dedicated functions for common verbs (GET, POST, PUT, DELETE, etc.) and handles connection management, cookies, and SSL certificates automatically. It provides flexible response parsing (raw, text, JSON, XML, HTML, images), authentication support including OAuth 1.0 and 2.0, and configuration helpers for timeouts, headers, proxies, and progress tracking. The standardized response object makes it straightforward to extract status, headers, and body content from API calls.
Contributors#
Resources featuring httr#
Jacqueline Nolis | I made an entire e-commerce platform on Shiny | RStudio (2022)
E-commerce requires passing data between many components like managing a shopping cart, taking payment, fulfilling orders, and sending emails. I’ve successfully created a full e-commerce platform entirely in R for a quirky side project. The R package ggirl lets users order ggplot2 plots as postcards and more via R functions. Those R functions pass data to a separate Shiny app, which then passes data other services like Stripe payment APIs and printing APIs. In this talk I will walk through how to use packages like httr, callr, and brochure to have your Shiny apps call external services and do many tasks in parallel. You’ll leave the talk with more ways to use Shiny than dashboards plus the knowledge to monetize your existing dashboards!
Talk materials are available at https://link.jnolis.com/rstudio22-slides
Session: Unexpected uses of R
Julia Silge | Monitoring Model Performance | RStudio
0:00 Project introduction 1:50 Overview of the setup code chunk 3:05 Getting new data 4:05 Getting model from RStudio Connect using httr and jsonlite 6:20 Bringing in metrics 9:45 Using the pins package 10:50 Using boards on RStudio Connect 13:30 Benefits of using pins 14:00 Visualizations using ggplot and plotly 17:00 Knitting the flexdashboard 18:10 Project takeaways
You can read Julia’s blogpost, Model Monitoring with R Markdown, pins, and RStudio Connect, here: https://blog.rstudio.com/2021/04/08/model-monitoring-with-r-markdown/
Modelops playground GitHub repo: https://github.com/juliasilge/modelops-playground
pins package documentation: https://pins.rstudio.com/
flexdashboard documentation: https://rmarkdown.rstudio.com/flexdashboard/
tidymodels documentation: https://www.tidymodels.org/

