RintermediatebackendAI generated

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

  1. 01

    Train and save a predictive model

    ~1.5h

    Train a simple model (e.g., logistic regression) on a sample dataset and save it with saveRDS.

  2. 02

    Build the plumber API skeleton

    ~1.5h

    Create a plumber.R file with a health-check endpoint and load the saved model at startup.

  3. 03

    Add a prediction endpoint

    ~2h

    Implement a POST endpoint that accepts JSON feature input, validates it, and returns a prediction with confidence.

  4. 04

    Add input validation and error responses

    ~1.5h

    Return clear HTTP error codes and messages for malformed or missing input fields.

  5. 05

    Document and test the API

    ~1.5h

    Enable plumber's Swagger UI and write example requests to verify the API behaves correctly.

Resources

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~8h · 5 steps

Tech stack

plumberjsonlite