Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

Making POST API calls to a Tableau Server using the Download Tool

wguicheney
5 - Atom

Hello everyone,

 

I'm currently working on a project to automate subscriptions using an Alteryx workflow. The strategy involves downloading (1) a list of relevant users from my organization's SQL database, (2) finding each users Tableau Server ID, (3) checking that list against the people subscribed to a specific view, and (4) subscribing those that aren't subscribed yet, or removing those that have left the organization.

 

I am stuck at the last step, which involves making a POST API call to the server to create new subscriptions. There seems to be very little information from the community about doing this in Alteryx, as there are already very few people doing this in Java or Python. 

 

The POST call involves passing two parameter values api-version and site id, as well as five attributable values, subscription-subject, content-type, content-id, schedule-id, and user-id. I have included all 5 in my call and triple-checked all their values. I have also naturally included an X-Tableau-Authorization token in my headers. Here is what the setup of my download tool looks like.

 

1.PNG 2.PNG 3.PNG 

 

I am getting the following error: a 100 Continue, followed by a 500 Internal Server Error. Not much help there, and as I am a Site Administrator but not a Server admin, I don't have access to the logs to explore further. 

 

4.PNG

 

The online Tableau developer documentation is providing me with lots of different information, such as "For POST and PUT requests, the request should include the Content-Length and Content-Type headers."   but I am not sure this is true, or how a Content-Length header should look like for example. The documentation does not provide many examples of POST requests.

 

Does anybody have any experience making POST API calls to the Tableau Server using Alteryx's Download tool? Any help would be greatly appreciated. 

12 REPLIES 12
neeleshapatil1
8 - Asteroid

Thanks but i am trying to frame a  response body given at following link. Like lets say twb file available on your local machine and you want publish it to tableau.

 

https://onlinehelp.tableau.com/v2018.1/api/rest_api/en-us/help.htm#REST/rest_api_ref.htm#Publish_Wor...

 

sathiya
8 - Asteroid

From my understanding REST API - you need to use the Content to upload ; If you want to update the file - best option is to use Pythin libraries

neeleshapatil1
8 - Asteroid
Hi Sathiya, Can you pls share your workflow where you implemented ahy Tableau REST API endpoint? Are you also executing CURL command through Alteryx? Thank you