3 Replies Latest reply on Mar 22, 2018 5:19 AM by William Guicheney

    Making POST API calls to a Tableau Server using Alteryx

    William Guicheney

      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.

        • 1. Re: Making POST API calls to a Tableau Server using Alteryx
          Patrick A Van Der Hyde

          Hello William

           

          Did you find any assistance on this with the Alteryx community either?  I am replying here to bring the post back to the top of the 'recent discussions' but it woudl be great to know if you have located a solution.  Sadly, I am not familiar enough with Alteryx to assist here. 

           

          Patrick

          • 2. Re: Making POST API calls to a Tableau Server using Alteryx
            Jonathan Drummey

            I haven’t made many REST API calls to Tableau, however I have been working on REST API calls to another app from Alteryx and I highly recommend adding Postman to your toolkit. I figure out what the REST calls need to look like in Postman and then translate that into Alteryx. It helps me by separating the “what exactly do I need to send to the remote app to get it do what I want” question from the “how do I need to configure Alteryx” question.

             

            Jonathan

            • 3. Re: Making POST API calls to a Tableau Server using Alteryx
              William Guicheney

              Hi Patrick,

               

              I did indeed find a solution

               

              1) Copy/pasting the Request Body provided in the Tableau Documentation into a Formula tool to build the "payload" manually. Here's what it looks like.

              Capture.PNG

              The Subscription-Subject and Content-Type parameters are simple pieces of text (The former will be the subject of the e-mail notification the Tableau Server sends out, the latter is either View or Workbook, depending on what you are subscribing people too). The content-id (unique ID of the view), schedule-id (unique ID of the specific schedule you are subscribing people too), and user-id (unique ID of each Tableau User) parameters are each obtained by making different REST API calls, which can be found in the Tableau REST API documentation

               

              2) Switching my Download tool a Custom POST request (Just select Custom in the API call options and specify POST manually). You than also need to tick 'Take Query String/Body from Field' and select the payload you built in the formula tool.

               

              Capture.PNG

               

              3) Using only X-Auth-Code as a Header (No need for a Content-Type header). You obtain this code using the Publish to Tableau Server Tool, you have to select Request Authorization token to obtain it and use it in your download tool to 'talk' to the server.

               

              Capture.PNG                                               Capture.PNG

              Was a real shot in the dark as neither Tableau nor Alteryx provided any documentation on this!