1 2 Previous Next 16 Replies Latest reply on May 10, 2016 8:23 AM by Toby Erkson

    tabcmd export fails with '***406 Not Acceptable' error

    Toby Erkson

      I'm getting the error "*** 406 Not Acceptable" when I run the this command:

      tabcmd export "GroupsInfo-QA/GroupsbyGroupName?:refresh=yes" --csv -f "D:\Application\Tableau\Tableau_Server\file_drop\group_users.csv"
      
      
      
      
      

      Yes, I'm logging in:

      tabcmd login -s "http://myServer.com" -u TERKSON -p "dasPassword"
      
      
      
      
      

      Even if I put the login commands in the export line I get the same error.  So it's not that.

       

      This is the URL of the view:

      http://myServer.com/#/views/GroupsInfo-QA/GroupsbyGroupName?:iid=3

      I followed the kb article here about this error and I it doesn't appear I'm doing anything wrong:

      http://kb.tableau.com/articles/knowledgebase/resolving-406-not-acceptable-error-message?lang=pt-br

       

      I get the same error if I remove the "?:refresh=yes" parameter.  Yes, if I open the report on the Server and Export to Excel I get the pretty data (200 rows) without issue.

       

      What am I doing wrong.  This used to work prior to 9.1.

        • 1. Re: tabcmd export fails with '***406 Not Acceptable' error
          Toby Erkson

          I forgot about this post.  My cmd script was working but now seems to have failed again.  Tableau Server 9.2.4 (QA environment).

          Here is the log file and the error is line 21:

          ----- BEGIN 2016-02-16 10:53:41.97 ----- 
          Logging in... 
          ===== Creating new session
          =====     Server:   http://myServer.com
          =====     Username: TERKSON
          ===== Connecting to the server...
          ===== Signing in...
          ===== Auto-sign in to site: Default
          ===== Creating new session
          =====     Server:   http://myServer.com
          =====     Username: TERKSON
          ===== Connecting to the server...
          ===== Signing in...
          ===== Succeeded
          ===== Succeeded
          Exporting... 
          ===== Continuing previous session
          =====     Server:   http://myServer.com
          =====     Username: TERKSON
          ===== Requesting 'GroupsInfo-QA/GroupsbyGroupName?:refresh=yes' from the server...
            *** 406 Not Acceptable
          Logging out... 
          ===== redirecting to http://myServer.com/auth
          ===== Signed out
          ----- END 2016-02-16 10:53:46.74 ----- 
          

           

          Here is the batch script (run as Administrator in case you're wondering):

          @ECHO OFF
          REM  by Toby Erkson
          REM  No inputs required.
          
          REM Insure command extensions are enabled, used by the FOR...DO command.
          SETLOCAL ENABLEEXTENSIONS
          
          SET dDate=%DATE:/=%
          SET ServerPath=D:\Application\Tableau\Tableau_Server
          SET sLogPath=D:\Application\Tableau\Scripts\script_logs
          SET sLogName=ExportGroupUsers.log
          SET mypath="D:\Application\Tableau\Scripts\Get_EncryptedPassword.ps1"
          SET encrypted="D:\Application\Tableau\Scripts\encrypted_password.txt"
          SET pass_word=dasPassword
          
          ECHO. 
          ECHO Exporting Group user info... (Logging file: %sLogPath%\%sLogName%)
          ECHO ----- BEGIN %dDate:~-4%-%dDate:~4,2%-%dDate:~6,2% %TIME% ----- >> %sLogPath%\%sLogName% 2>&1
          ECHO Logging in...
          ECHO Logging in... >> %sLogPath%\%sLogName% 2>&1
          tabcmd login -s "http://myServer.com" -u TERKSON -p "%pass_word%" >> %sLogPath%\%sLogName% 2>&1
          ECHO Exporting...
          ECHO Exporting... >> %sLogPath%\%sLogName% 2>&1
          tabcmd export "GroupsInfo-QA/GroupsbyGroupName?:refresh=yes" --csv -f "%ServerPath%\file_drop\group_users.csv" >> %sLogPath%\%sLogName% 2>&1
          ECHO Logging out...
          ECHO Logging out... >> %sLogPath%\%sLogName% 2>&1
          tabcmd logout >> %sLogPath%\%sLogName% 2>&1
          ECHO ----- END %dDate:~-4%-%dDate:~4,2%-%dDate:~6,2% %TIME% ----- >> %sLogPath%\%sLogName% 2>&1
          ECHO. >> %sLogPath%\%sLogName% 2>&1
          ECHO Exporting Group user info finished.
          REM The /b will return our error level
          EXIT /b %EL%
          

           

          Are there any glaring errors?

          • 2. Re: tabcmd export fails with '***406 Not Acceptable' error
            Jeff Strauss

            Hey Toby, have you tried running it yet without the "SETLOCAL ENABLEEXTENSIONS"?  What you have looks pretty standard except for this; I tried to enable extensions once while troubleshooting and it seemed to mess everything up for the Tableau code and I had to get around the for loop variable stuff without it.

            • 3. Re: tabcmd export fails with '***406 Not Acceptable' error
              Toby Erkson

              Shawn, single percent signs for designating variables is correct.  You would use a double percent sign in a FOR...IN loop (see here, love this site: Batch files - FOR loops )

              • 4. Re: tabcmd export fails with '***406 Not Acceptable' error
                Toby Erkson

                I removed the SETLOCAL ENABLEEXTENSIONS command and encountered the same error i.e. no change.

                 

                I actually do use a FOR...IN loop to get the encrypted password.  For the time being I'm not using the loop until I can get this figured out.

                • 5. Re: tabcmd export fails with '***406 Not Acceptable' error
                  Jeff Strauss

                  here's a simple bat file (that does an export) that I successfully tested last week with 9.2.4, change the user specifics, path, reportname and try it out.

                   

                  SET ERRORLEVEL=0

                  for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j

                  set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2%

                  echo %ldt%

                   

                  g:

                   

                  SET /p TABLEAU_INSTALLED_VERSION=<"G:\Scripts\ServerAdmin\Parm_Current_version.txt"

                  SET TABLEAU_SERVER=http://localhost

                  SET TABLEAU_USER_NAME=DTM_Tableau_SVC2

                  SET TABLEAU_USER_PASSWORD=xxxxxxx

                  SET /p TABLEAU_EXPORT_PATH=<"G:\Scripts\ServerAdmin\Parm_worker_export.txt"

                  SET TABLEAU_USAGE_PATH=%TABLEAU_EXPORT_PATH%\Scripts\ServerAdmin\TableauAdminData\Tableau_usage-

                   

                  CD G:\Tableau\Tableau Server\%TABLEAU_INSTALLED_VERSION%\bin

                   

                  tabcmd login --server %TABLEAU_SERVER% --username %TABLEAU_USER_NAME% --password %TABLEAU_USER_PASSWORD% --timeout 1800

                  tabcmd export "/ReportUsageDiagnostics/UsageOverview" -f "%TABLEAU_USAGE_PATH%%ldt%.pdf" --password %TABLEAU_USER_PASSWORD% --fullpdf --timeout 1800

                  tabcmd logout

                  • 6. Re: tabcmd export fails with '***406 Not Acceptable' error
                    Toby Erkson

                    Jeffrey,

                    I modified your script to fit and when it exported the PDF it worked!   When I changed from PDF to CSV it failed like before

                     

                    I went to my original script, changed it from CSV to PDF and it worked.  Back to CSV and it failed   ***?

                     

                    I'm wondering if there is a bug in tabcmd for --csv?

                     

                     

                    BTW, thanks for your script.  I saw the line

                    SET TABLEAU_SERVER=http://localhost
                    

                    and thought, "GENIUS!"  Why am I bothering with the actual Server name when I could use localhost -- since it runs on the host machine anyway -- and thus make copying scripts to my other Servers that much easier (less editing).

                     

                     

                    • 7. Re: tabcmd export fails with '***406 Not Acceptable' error
                      Jeff Strauss

                      ah, I am unable right now to re-test the above script (because we uninstalled 9.2.4 from dev to debug our AD issues), but I had a look at another script that does do an export to CSV and this did seem to work last week.  See if there's any difference with this one...

                       

                      SET ERRORLEVEL=0

                      for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j

                      set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2%

                       

                      g:

                       

                      SET LOCALAPPDATA=C:\Users\%USERNAME%\AppData\Local

                       

                      SET /p TABLEAU_INSTALLED_VERSION=<"G:\Scripts\ServerAdmin\Parm_Current_version.txt"

                      SET TABLEAU_SERVER=http://localhost

                       

                      cd G:\Tableau\Tableau Server\%TABLEAU_INSTALLED_VERSION%\bin

                       

                      SET /p TABLEAU_EXPORT_PATH=<"G:\Scripts\ServerAdmin\Parm_worker_export.txt"

                       

                      SET TABLEAU_USER_NAME=DTM_Tableau_SVC2

                      SET TABLEAU_USER_PASSWORD=xxxxxxxxx

                      SET TABLEAU_USAGE_PATH_GROUP=%TABLEAU_EXPORT_PATH%\Scripts\ServerAdmin\TableauAdminData\Defined_Tableau_Groups.csv

                       

                      REM ****************************************************************************************************************************

                      REM ***Housekeeping, delete previous run files**********************************************************************************

                      REM ****************************************************************************************************************************

                      del /Q %TABLEAU_USAGE_PATH_GROUP%

                       

                      tabcmd login --server %TABLEAU_SERVER% --username %TABLEAU_USER_NAME% --password %TABLEAU_USER_PASSWORD% --timeout 1800

                      tabcmd export "/Admin_ADSync_Batch/Admin_CSV_TblGroup_corplist?:refresh=yes" -f "%TABLEAU_USAGE_PATH_GROUP%" --csv --password %TABLEAU_USER_PASSWORD% --timeout 1800

                      tabcmd logout

                       

                      :END_PROC

                        Echo Exit Code %ERRORLEVEL%

                        EXIT /B %ERRORLEVEL%

                      • 8. Re: tabcmd export fails with '***406 Not Acceptable' error
                        Jeff Strauss

                        also, just for kicks, try adding a "/" in front of the workbook name to see what happens (i.e. tabcmd export /workbookname/view....).  I forget if it's needed or not.

                        • 9. Re: tabcmd export fails with '***406 Not Acceptable' error
                          Toby Erkson

                          I did and there was no difference, still got an error.

                          • 10. Re: tabcmd export fails with '***406 Not Acceptable' error
                            Robin Cottiss

                            Toby, can you try republishing the workbook to your server (I am wondering if it was published in an earlier version) then try the export again. This would not be a solution but it might be a workaround and give a clue that this needs a support case.

                             

                            Robin

                            1 of 1 people found this helpful
                            • 11. Re: tabcmd export fails with '***406 Not Acceptable' error
                              Toby Erkson

                               

                              BAM!

                              Robin,

                              You are correct, it was an earlier version: 8.3.  I downloaded, republished, ran my original script, and it worked.  Log file confirmed and there's a new .csv in the file drop location.  Pure awesomeness, thank you!

                              • 12. Re: tabcmd export fails with '***406 Not Acceptable' error
                                Robin Cottiss

                                Toby, I am glad this worked. Our support team has asked if you can open a support case so that we can bring this to the attention of our product team. Mention that I asked you to do this.  This will also help us document any interim workarounds.

                                 

                                Thank you for being such a great Tableau Ambassador!

                                 

                                Robin

                                • 14. Re: tabcmd export fails with '***406 Not Acceptable' error
                                  Toby Erkson

                                  Reply back from Tableau Support (emphasis is mine):

                                  The “406: Not Acceptable” message can be caused by many things, but in this case it is from the differing versions of Tableau Server and the format used to save the workbooks. Due to changes made in newer versions of Tableau Server and Desktop, tabcmd needs to be of the same major version as the saved workbook to function fully. As you noticed, since your workbooks were created and saved with version 8.1 and 8.3, using tabcmd version 9.2 will not work. The link below contains more information about compatibility between different versions of Tableau software:

                                   

                                  http://kb.tableau.com/articles/knowledgebase/desktop-and-server-compatibility#Compatibility

                                   

                                  Read that carefully and take heed.  So for any admins who are creating their own reports and relying upon tabcmd to 'work' them you will need to keep track of their product version and update them every time you make a major version upgrade!   Not cool.

                                  1 of 1 people found this helpful
                                  1 2 Previous Next