r - Provide datasets dynamically via GET using opencpu? -
i not sure whether on right track question, here trying do: implement data api endpoints, e.g.:
hadley.ocpu.io/ggplot2/data/msleep/csv
and hope able use great json, csv stuff that's provided opencpu
. yet not call static file stored somewhere within package rather call function queries database , returns r object json / csv functionality of opencpu
can process.
i read post , corresponding documentation. teaches how make rpc calls using js. great, requires me build minimal js app. however, share or embed single link nothing returning csv or json.
i tried create package contains function this:
hello <- function() { # mtcars replaced # whatever db returns mtcars }
but http://localhost:8100/ocpu/library/resttest/r/hello/json
returns json of function itself. did miss simple / basic or more difficult create such custom endpoint?
though nice able pass arguments using standard get, live parameter less functions , summarize them in package contains 1 function every dataset.
edit: part of documentation (at bottom) 'common special case' close. have request, have link instead of js client / call. https://www.opencpu.org/api.html#api-arguments
Comments
Post a Comment