Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing POST Requests with httpuv package for building a simple API with R

I am trying to build a simple api using httpuv package. The documentation says that one could use the same Rook definition. While using the Rook package one can simple use:

req$POST()

I haven't been able to figure out how to manage simple HTTP POST requests and get their body.

Any hints?

like image 231
jpmarindiaz Avatar asked May 20 '14 21:05

jpmarindiaz


1 Answers

I finally got it working. I found the answer lying somewhere in the opencpu package.

Simply read the POST body stream using:

input <- req[["rook.input"]];

postdata <- input$read_lines();

like image 158
jpmarindiaz Avatar answered Nov 15 '22 03:11

jpmarindiaz