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.
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.
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.
I think you should definitely build XML with all the paremeters you mentioned as is described in Tableau REST API reference.
Send this XML as a payload.
You should also add HTTP header Content-Type with value of "application/xml or "text/xml"
Hope it will help you.
Thanks for the input. I ended up managing to get it working by following the following steps:
1) Copy/patsing the Request Body provided in the Tableau Documentation into a Formula tool to build the "payload" manually. Here's what it looks like:
2) Switching my Download tool a Custom POST request (Just select Custom in the API call options and write POST)
3) Using only X-Auth-Code as a Header (No need for a Content-Type header)
Was a real shot in the dark as neither Tableau nor Alteryx provided any documentation on this!
I am working on an Alteryx workflow to move Tableau Workbooks from one Tableau Server Project to another. The basic Workflow is very similar to the steps documented in this tread however I keep getting a "resourse not found" error.
In my formula tool, I cant figure out out to get the tsRequest xml text to take as even though I am enclosing the whole thing in quotes, the formula tool is not accepting the xml. I therefore am trying to configure the formula tool in a format that looks like this:
[server] + "/api/2.4/sites/" + [site_id] + "/projects/" + "project id where I am trying to move the workbook to" + "/workbooks/" + "workbook that I am trying to move id"
other key pieces of this workflow is a publish to tableau server tool before the formula that gets me a auth token and a download tool after the formula tool that is set up this way:
basic tab - url field = url
header tab - x-tableau-auth selected
payload tab - http action = custom "POST" and compose query string/body is selected
Any enlightenment would be appretiated.
~ Eric Marowitz
My Use case that worked may help your issues - Add user if they do not exists in the server
1. We get the authentication token using publish to tableau
2. Create all variables -URL , RequestXML , Servername - pass to download tool
3. Please see screenshot for download tool - Basic and Header are same as the screenshot in the post - In Payload- use Take a query String/Body from Field - i created the XML using formula field
4. Keep Fiddler open to see how the call goes - if any issue take the information and use another tool call Postman or Rest tools or CURL command - to test your call.
For question about formula not acception quotes - either you can use escape characters or add single quote around double quotes
'"<tsRequest><user id="' + [USER_LUID] + '"/></tsRequest>"'