<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Power BI Embedded API - Updating a specific table in dataset in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244235#M42747</link>
    <description>&lt;P&gt;Applyrefreshpolicy = false will force a full refresh of all dependent partitions.&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 12:22:53 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-05-19T12:22:53Z</dc:date>
    <item>
      <title>Power BI Embedded API - Updating a specific table in dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3240783#M42721</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use PBI API to refresh a specific table in dataset rather than full dataset. I've used following code to refresh only table1 in dataset. But it seems like refreshing all tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var parameters = new Dictionary&amp;lt;string, string&amp;gt;
            {
                { "table", "Table1" },
                { "refreshType", "Full" }
            };
            
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken);
            try
            {
                var test = await client.PostAsJsonAsync($"https://api.powerbi.com/v1.0/myorg/groups/{groupid}/datasets/{datasetid}/refreshes",
                new StringContent(JsonConvert.SerializeObject(parameters), Encoding.UTF8, "application/json"));
            }
            catch (System.Exception)
            {

                throw;
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where as if I use XMLA endpoint - I can refresh only one single table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please suggest what am I doing wrong here? Also, what is the best way to see it's refresing all tables as I am going through only time it takes to refresh dataset? Wiht single table it take 10 seconds where as whole dataset takes longer and it's consistent accros Dev, Test and Prod environemnt.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 17:04:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3240783#M42721</guid>
      <dc:creator>mihirsp1988</dc:creator>
      <dc:date>2023-05-17T17:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded API - Updating a specific table in dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3243300#M42738</link>
      <description>&lt;P&gt;Your parameters have the wrong structure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/connect-data/asynchronous-refresh#parameters" target="_blank"&gt;Enhanced refresh with the Power BI REST API - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 01:34:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3243300#M42738</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-19T01:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded API - Updating a specific table in dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244040#M42743</link>
      <description>&lt;P&gt;Thanks Ibendlin. I've also tried that but whenever I try it from Enhanced refresh it works fine but it does not work from my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The new code I used is as below:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var accessToken = aadService.GetAccessToken();
            //var parameters = new Dictionary&amp;lt;string, string&amp;gt;
            //{
            //    { "table", "{tablename}" },
            //    { "refreshType", "Full" }
            //};
            string jsonText = "{\r\n  \"type\": \"full\",\r\n  \"commitMode\": \"transactional\",\r\n  \"objects\": [\r\n      {\r\n        \"database\": \"{Databasename}\",\r\n        \"table\": \"{tableName}\"\r\n      }\r\n    ],\r\n  \"applyRefreshPolicy\": \"false\"\r\n}";
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken);
            try
            {
                var test = await client.PostAsJsonAsync($"https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes",
                //new StringContent(JsonConvert.SerializeObject(parameters), Encoding.UTF8, "application/json")
                jsonText);
            }
            catch (System.Exception)
            {

                throw;
            }&lt;/LI-CODE&gt;&lt;P&gt;Is it something wrong with my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mihir&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 09:40:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244040#M42743</guid>
      <dc:creator>mihirsp1988</dc:creator>
      <dc:date>2023-05-19T09:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded API - Updating a specific table in dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244235#M42747</link>
      <description>&lt;P&gt;Applyrefreshpolicy = false will force a full refresh of all dependent partitions.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 12:22:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244235#M42747</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-19T12:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embedded API - Updating a specific table in dataset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244316#M42748</link>
      <description>&lt;P&gt;I tried this but it still did not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After looking into details I think the issue is around how I code my request body in JSON. Beacause when I used following code it started working and I can see Enhanced API as request type in PBI service.&lt;/P&gt;&lt;P&gt;Following the final code I used:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var body = @"{
                " + "\n" +
                @"    ""type"": ""Full"",
                " + "\n" +
                @"    ""commitMode"": ""transactional"",
                " + "\n" +
                @"    ""maxParallelism"": 2,
                " + "\n" +
                @"    ""retryCount"": 2,
                " + "\n" +
                @"    ""objects"": [
                " + "\n" +
                @"        {
                " + "\n" +
                @"            ""table"": ""TableName""
                " + "\n" +
                @"            
                " + "\n" +
                @"        }
                " + "\n" +
                @"    ]
                " + "\n" +
                @"}";

            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", aadService.GetAccessToken());
            try
            {
                var test = await client.PostAsync($"https://api.powerbi.com/v1.0/myorg/groups/{groupid}/datasets/{datasetId}/refreshes",
                                   new StringContent(body, Encoding.UTF8, "application/json"));
            }
            catch (System.Exception)
            {
                throw;
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Ibendlin for your support.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 13:04:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embedded-API-Updating-a-specific-table-in-dataset/m-p/3244316#M42748</guid>
      <dc:creator>mihirsp1988</dc:creator>
      <dc:date>2023-05-19T13:04:39Z</dc:date>
    </item>
  </channel>
</rss>

