Back to docs


On this page

Getting started

At the heart of a Shaip developed in R is the plumber package. Plumber provides a framework to handle HTTP requests and execute R code. The Shaipup platform provides a wrapper around the plumber that allows authenticated access, tracks usage, ensures appropriate response codes and validates all data being passed to each Shaip. HTTP requests have a structured framework and plumber routes the requests. A Shaip API constrains the endpoint to /shaip and it has to be a POST request with JSON data passed in the body. We reserve the parameter inputs to identify the Shaip owner and the Shaip name. This configuration helps simplify the R code and ensures users can easily access your Shaip and it minimises complexity for Shaip users.

Local versus deployed Shaips

Screenshot 2024-06-03 at 12.04.21 PM.png

JSON inputs and return values

#* Manage Employees
#* @serializer unboxedJSON
#* @post /shaipfunction(req, res) {      
employees <- req$body

employees$Building <- c("Links", "Bright")

res$body <- employees

}
[
{"Name":"Bill", "Age": 35, "ID": "HP176"},
{"Name":"Heather", "Age": 27, "ID": "HP199"}
]
Name Age ID
Bill 35 HP176
Heather 27 HP199
Name Age ID Building
Bill 35 HP176 Links
Heather 27 HP199 Bright
[
{"Name":"Bill", "Age": 35, "ID": "HP176", "Building": "Links"},
{"Name":"Heather", "Age": 27, "ID": "HP199", "Building": "Bright"}
]
#* Manage Employees
#* @serializer unboxedJSON
#* @post /shaip
function(req, res) {      
employees <- req$body
print(employees)
employees$Building <- c("Links", "Bright")
print(employees)
res$body <- employees

}

Summary