Tableau Prep or Tableau does not have A built in rest API connector, but we can download data from rest API using  Power Shell and pass it to  Tableau Prep Flow.

Getting REST API Data

We will be using  IEX Share price API for the purpose of this demonstration. Try the below one liner in your command tine and see the results. (This end point provides last 3 month share prices of Apple).

powershell.exe "Invoke-RestMethod ''"
Rest API Data in Command-Line

If your rest endpoint requires authentication or custom headers, ‘Invoke-RestMethod’  cmdlet have options to handle that too.

Here is the complete script to download data, convert to csv and run the flow

@echo off
powershell.exe "(Invoke-RestMethod '')|Export-Csv -Path 'C:/Automation/rest_data.csv' -NoTypeInformation"
call  "C:\Program Files\Tableau\Tableau Prep 2019.1\scripts\tableau-prep-cli.bat" -t "C:\Automation\rest.tfl"


Leave a Reply

Your email address will not be published. Required fields are marked *