Plumber REST API for Model Predictions
Wrap a trained R predictive model (such as a regression or classification model) in a REST API using the plumber package, accepting JSON input and returning predictions. Learners practice exposing R code as HTTP endpoints, request validation, and API documentation with Swagger.
- Estimate
- ~8h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
plumber · jsonlite
Project roadmap
- 01
Train and save a predictive model
~1.5hTrain a simple model (e.g., logistic regression) on a sample dataset and save it with saveRDS.
- 02
Build the plumber API skeleton
~1.5hCreate a plumber.R file with a health-check endpoint and load the saved model at startup.
- 03
Add a prediction endpoint
~2hImplement a POST endpoint that accepts JSON feature input, validates it, and returns a prediction with confidence.
- 04
Add input validation and error responses
~1.5hReturn clear HTTP error codes and messages for malformed or missing input fields.
- 05
Document and test the API
~1.5hEnable plumber's Swagger UI and write example requests to verify the API behaves correctly.
Resources
- DocsR Manuals
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack