Episode 13: Inside Plumber 1.0 (Barret Schloerke Part 2)
By The Shiny Dev Series Team
September 17, 2020
Resources mentioned in the episode
plumber
allows you to create a web API by merely decorating your existing R source code withroxygen2
style comments.- Site: https://www.rplumber.io/
- Demos:
- NEW - Hex logo and website!
- NEW - pipe-able programatic interface
- Demo:
plumb(dir = "plumber/pipe") %>% pr_run()
- Demo:
- NEW - POST body parsing
- Process incoming POST body data
- Ex: HTML forms, multipart forms, csv, tsv, json, yaml, feather and rds.
- Like serializers, register new POST body parsers
- Site: https://www.rplumber.io/reference/parsers.html
- More Serializers!
- Serialize outgoing route data
- Ex: plain
text
,json
,yaml
,csv
,tsv
,rds
,feather
- NEW - Register image serializers:
svg
,tiff
,bmp
,pdf
. (Pre existing:png
,jpeg
) - Site: https://www.rplumber.io/reference/serializers.html
- NEW - Download return values as attachments!
- Site: https://www.rplumber.io/reference/as_attachment.html
- Demo:
plumb_api("plumber", "16-attachment") %>% pr_run()
- NEW - Async / promises
- Demo:
plumb("plumber/plumber-future.R") %>% pr_run()
- Demo:
- NEW - API UIs (rapidoc)
- Register new User Interfaces to look at your API
- Demo:
plumb(dir = "plumber/rapidoc") %>% pr_run()
- Thank you to Bruno Tremblay (
@meztez
) for his heavy contributions to plumber!
- Recent conference talks about plumber:
- Democratizing R with plumber APIs (James Blair): rstudio.com/resources/rstudioconf-2019/democratizing-r-with-plumber-apis
- Practical plumber patterns (James Blair): rstudio.com/resources/rstudioconf-2020/practical-plumber-patterns/
- Bike Prediction example application with plumber API and Shiny: solutions.rstudio.com/tour/bike_predict/
Episode Timestamps
0:00 - Intro
1:14 - Introduction to plumber
4:14 - Example of plumber API
7:14 - Pipeable interface for plumber
9:19 - plumber’s new hex logo!
9:24 - Serializers in plumber
13:04 - Parsers in plumber
14:30 - as_attachment
for serializers
15:50 - Demo of downloading an attachment from API
16:07 - A consistent way to check for plumber APIs with available_apis()
18:50 - Async processing in plumber
24:23 - Demo of the plumber documentation UI
29:20 - Example of decoupling data source from Shiny app
29:50 - Episode wrapup