0

I'm trying to get data into Tableau from a RESTful API in which a certain endpoint is accepting a set of parameters and returning tabular data. A more correct representation of our request and response is as below:

Request:

http://api-baseurl:8080/query_data/Soap?access_token=123456789

Reponse:

[{
    "Item": "Soap",
    "Market": "Domestic",
    "Price": 120
  },
  {
    "Item": "Soap",
    "Market": "Global",
    "Price": 190
  }]

I also have a csv file with columns, Item and Owner(some irrelevant column name). I want to load this csv file to Tableau and upon selection of filters on Item column, I want to call the API as in the above example.

What I did so far:

I tried to use the TabPy, however it returns only measure columns. I tried to use a SCRIPT_STR function as in the below example:

SCRIPT_STR("
import requests
response = requests.get(f'http://api-baseurl:8080/query_data/{_arg1}?access_token=123456789')
dict_list = response.json()
response=str(dict_list)
return response
",ATTR([Item]))

Unfortunately it is returning a single string and during SPLIT, I have below error:

The SPLIT function cannot be applied to table calculations and fields from multiple data sources

Apparently since a single string is returned, it is not a wise way to query data.

Also tried to use the Web Data Connector, but it is only accepting hardcoded API URLs.

Now my questions:

Is something like this be applicable in Tableau? If so what property should I use? Is TabPy the correct path? Is the WDC has this capacity?

Looking forward to any kind of help.

Thanks for you interest.

0 Answers0