Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (17.6k points)
reshown by

I'm using the Tableau REST API via C# to try and get a list of user's favorites. I have tried using API Version 2.8,3.0, 3.1 and 3.2 with little to no joy. 2.8 and 3.0 respond with:

<?xml version='1.0' encoding='UTF-8'?>

<tsResponse xmlns=""xmlns:xsi=""xsi:schemaLocation=""> //3.0.xsd when using API Version 3.0

     <favorites/> //There should be a plethora of favorites of all varieties in here.


3.1 and 3.2 give me a (404) Not found.

The code I have in c# is:

public static string QueryFavourites(string APIVersion, string AuthToken, string SiteID, string UserID)


        string result = "";



            string url = $@"{Server}/api/{APIVersion}/sites/{SiteID}/favorites/{UserID}";

            // Create the web request 

            WebRequest request = WebRequest.Create(url) as WebRequest;

            request.PreAuthenticate = true;

            request.Headers.Add($"x-tableau-auth: {AuthToken}");

            // Get response 

            using (WebResponse response = request.GetResponse())


                // Get the response stream 

                StreamReader reader = new StreamReader(response.GetResponseStream());

                // Read the whole contents and return as a string 

                result = reader.ReadToEnd();


            return result;


        catch(Exception E)


            logger.Error("Error! System Says: " + E.Message);

            return result;



I know the method works, as it is used for multiple other API calls using a different URL for each (depending on the call). Does anyone know if its an issue on the tableau end or on my end? Apparently, it should work with Tableau server 2.8 or above, which we have. (i think we're running 2018.1)

Is anyone able to get a list of favorites for a user using tableau REST API? Where am I going wrong?

1 Answer

0 votes
by (47.2k points)
edited by

Step 1: Query a user on the site. Refer to the following link for more details: 

Step 2: Check if the user is the same which you are authenticated as; and the same user has to query for favorites

Step 3: Try adding a favorite with the REST API (DataSource, View or Workbook)

Step 4: Get the favorites for the user, the data source/view/workbook you added as a favorite which should be present. Refer to the following link for more details: 

  • If you want to Update the user, Add user to site or Add user to Group, these are the links for getting documentation.

  • These things can also be done with Postman/tool of your choice.

  • You have to ensure the user that is querying another user (or the same) is a server admin (just to be safe), and making sure that you are a member of the same site of another (or the same) user.

Want to be an expert in Tableau? Check out the Tableau Training to get the right assistance.

Related questions

Browse Categories