Forum Discussion
ann_joseph
Aug 13, 2020Copper Contributor
Variable substitution in rest api filter parameters
Hi All, I am a beginner in powershell.I was trying to call Tableau REST APIs using powershell.To make the script generic i would need to pass the filter parameters by through a variable.In the ex...
ann_joseph
Aug 14, 2020Copper Contributor
Joshua King Thank you so much for the reply.
I am looking to perform the inject step prior to the import-csv. So that the script can become more generic and others can just change the $param and $filter from the top portion of variable assignments rather than allowing them to edit inside the script.
$param = 'vf_Filter1={0}&vf_Filter2={1}'
$Filter = $param -f $_.'Fit Name', $_.'Set Name'
Import-Csv $filterfile | ForEach-object{
$Uri = "$server/api/3.5/sites/$siteID/views/$responseD/PDF?$Filter" Invoke-RestMethod -Uri $Uri }
ann_joseph
Aug 14, 2020Copper Contributor
@Joshua King I tried this solution.But the $Filter in the Uri is space when we put it in uri.
Kindly help