mock_tableau_request {plumbertableau}R Documentation

Create a mock JSON request that mimics the request structure of Tableau

Description

mock_tableau_request() creates a JSON object formatted like a request from Tableau. The JSON object it returns can be pasted directly into the "Try it out" field in the Swagger documentation for an endpoint to test its functionality.

Usage

mock_tableau_request(script, data, ...)

Arguments

script

String indicating the path to the endpoint to be called

data

A list or dataframe that is serialized to JSON

...

Additional arguments passed to jsonlite::toJSON()

Details

Behind the scenes, Tableau sends all requests to the ⁠/evaluate⁠ endpoint. Each request is a JSON object containing two items: script and data. plumbertableau uses script to specify an individual endpoint to call, and passes the arguments in data on to the function at that endpoint.

Value

A JSON object that can be passed to a Tableau endpoint

Examples

mock_tableau_request("/loess/predict", mtcars[,c("hp", "mpg")])


[Package plumbertableau version 0.1.1 Index]