1 Reply Latest reply on Jul 4, 2017 3:55 AM by lenaic.ridinger

    Tableau Server Authentication through VBA

    Ray Rashid

      I'm trying to authenticate Tableau Server via REST API through an Excel Application.


      However, I am prompted with a "Bad Request", XML Malformed or Incomplete Error. Can anyone pick out what I may have done wrong? I have followed the API documentation to a tee, to no avail.


      Sub exportExcelFromTableauServer()

          Dim fileUrl
          Dim signinUrl
          Dim myxml As String
          Dim userName
          Dim password
          Dim site
          userName = ""
          password = ""
          site = ""
          'URL for sign in
          signinUrl = "http:///....api/2.3/auth/signin"


          Set objHTTP = CreateObject("MSXML2.SERVERXMLHTTP")
          'create payload with user, pass and Site
          xmlPayload = "<tsRequest>" & _
                                    "<credentials name=""" & userName & """ password=""" & password & """>" & _
                                          "<site contentUrl=""" & site & """ />" & _
                                    "</credentials>" & _

          MsgBox xmlPayload, , "XML Payload"
          'Create the connection string and send payload
          objHTTP.Open "POST", signinUrl, False, xmlPayload
          objHTTP.SetRequestHeader "Content-Type", "application/xml"
          connResponse = objHTTP.ResponseText   ' Get the response text
          MsgBox connResponse, , "Connection Response" 'Display response text

      End Sub