2 Replies Latest reply on Dec 15, 2019 7:00 PM by Anil G

    REST API - previewImage Not Working

    Janusz Jasinski

      I am using the API to try and get the previewImage of a view. Since the site is under NT authentication, I can't "cheat" and go down static route. Here's my code in ClassicASP


      Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")

        httpRequest.Open "GET", "https://tabserver/api/2.0/sites/bc008ac5-3738-45e0-8ecf-c6dbf4f210e1/workbooks/1636c0a4-bd92-4a9a-ac52-1b79be3fd530/views/1087a422-5b16-414c-9502-499f2501f20e/previewImage", False

        httpRequest.SetRequestHeader "Content-Type", "text/xml"

        httpRequest.SetRequestHeader "X-Tableau-Auth", session("strViewToken")


        postResponse = httpRequest.ResponseText & " - " & httpRequest.Status

        response.Write postResponse


      The token is set earlier in the page and that particular API call works just fine!!! The token is fine. Here is the message:


      Unauthorized Access

      Invalid authentication credentials were provided. - 401


      Please advise! I can login using the REST API and I can authenticate using the REST API but can't do this for some reason


      Here is the URL on Tableau's site: http://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api_ref.htm#Query_View_with_a_Preview_Image%3FTocPath%3DAPI%2520Reference%7C_____43


      My user has got access - I've tried with admins as well.


      Could my problem be down to this: HTTP 401 - Not Authorized