postmanmicrosoft-r

Passing data frame to MS R Server model operationalisation


I am running ML server and I have a service deployed that expects one of its inputs to be a data.frame.

When I connect with R to that API endpoint using mrsdeploy, I am able to pass a data.frame. I would like to do the same in prostman using json.

How can I format my json for lets say an input (data.frame) of characteristics about someone?

I would assume its something like { ... "bio": { "age" : 23, "height" : 12, "eyeC" : "red" } }

I have tried a variety of combinations all getting back an error about converting to data.frame in R


Solution

  • You have to pass the data frame in column format, not rows. Ie, if your data looks like this:

    foo bar
      1   a
      2   b
      3   c
    

    Then the API expects the input to be

    {
      "foo": [1, 2, 3],
      "bar": ["a", "b", "c"]
    }