<?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 InvalidRequest Error when updating dataset parameter only on a particular report in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/InvalidRequest-Error-when-updating-dataset-parameter-only-on-a/m-p/1266119#M25031</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble with updating dataset parameter on my report.&lt;/P&gt;&lt;P&gt;the process itself is quite simple :&lt;/P&gt;&lt;P&gt;1. request an oauth token&lt;/P&gt;&lt;P&gt;2. publish my template to power bi service&lt;/P&gt;&lt;P&gt;3. get the published dataset and report ID&lt;/P&gt;&lt;P&gt;4. update parameter on the published report's dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code that I'm using :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function getDataset_Report(accessToken) {
            xmlHttp.open("GET",getReportIDUrl,true);
            xmlHttp.setRequestHeader('Authorization', 'Bearer '+accessToken);
            xmlHttp.responseType = "json";
            xmlHttp.onload = function () {
                if (xmlHttp.readyState === xmlHttp.DONE) {
                    if (xmlHttp.status === 200) {
                        var d = xmlHttp.response.datasets;
                        var r = xmlHttp.response.reports;
                        if (r != 0 &amp;amp;&amp;amp; d != 0) {
                            console.log('---------------start updating parameter----------------')
                            reportId = r[0].id;
                            console.log(reportId);
                            datasetId = d[0].id;
                            console.log(datasetId);
                            embUrl = r[0].embedUrl;
                            clearInterval(set_interval_id);
                            var changeParamUrl = "https://api.powerbi.com/v1.0/myorg/groups/" + groupId + "/datasets/" + datasetId + "/Default.UpdateParameters";
                            changeParam(changeParamUrl, accessToken, paramData, datasetId)
                            console.log('---------------finished updating parameter----------------')
                        } else {
                            run_getDataset_Report(accessToken)
                        }
                    }
                    else{
                        removeLoading();
                    };
                }
                }
            xmlHttp.send();
        }

        function changeParam(theUrl,accessToken,paramData, datasetId) {
            console.log(paramData);
            xmlHttp.open("POST",theUrl,true);
            xmlHttp.setRequestHeader('Authorization', 'Bearer '+accessToken);
            xmlHttp.setRequestHeader("Content-type","application/json");
            xmlHttp.onload = function () {
                if (xmlHttp.readyState === xmlHttp.DONE) {
                    if (xmlHttp.status === 200) {
                        console.log('---------------start refreshing datasets----------------')
                        var getDatasourceUri = "https://api.powerbi.com/v1.0/myorg/groups/"+ groupId +"/datasets/" + datasetId + "/datasources"
                        getDatasourceInfo(getDatasourceUri, accessToken, paramData, datasetId)
                        console.log('---------------finished refreshing datasets----------------')
                    }
                    else{
                        removeLoading();
                    };
                    }
            }
            xmlHttp.send(paramData);
        };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now the strange thing about this problem is I have 3 reports, 2 already existed reports and 1 new report.&lt;/P&gt;&lt;P&gt;this problem only occurred on my new report which I'm trying to publish.&lt;/P&gt;&lt;P&gt;when I use this code to update the parameter on the other two it works just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now, I also compared the settings between my new report and the old one:&lt;/P&gt;&lt;P&gt;1. both already have the parameter "Enabled Load" checked&lt;/P&gt;&lt;P&gt;2. both are being released by the same application user, which have admin permission&lt;/P&gt;&lt;P&gt;3. both are being released to the same powerBI workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the only difference that I could think of is my new report is created &lt;STRONG&gt;after&amp;nbsp;&lt;/STRONG&gt;I updated my powerBI desktop,&lt;/P&gt;&lt;P&gt;but I don't think it would have any effects or whatsoever on this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any insight would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bests,&lt;/P&gt;</description>
    <pubDate>Sat, 01 Aug 2020 07:48:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-08-01T07:48:13Z</dc:date>
    <item>
      <title>InvalidRequest Error when updating dataset parameter only on a particular report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/InvalidRequest-Error-when-updating-dataset-parameter-only-on-a/m-p/1266119#M25031</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble with updating dataset parameter on my report.&lt;/P&gt;&lt;P&gt;the process itself is quite simple :&lt;/P&gt;&lt;P&gt;1. request an oauth token&lt;/P&gt;&lt;P&gt;2. publish my template to power bi service&lt;/P&gt;&lt;P&gt;3. get the published dataset and report ID&lt;/P&gt;&lt;P&gt;4. update parameter on the published report's dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code that I'm using :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function getDataset_Report(accessToken) {
            xmlHttp.open("GET",getReportIDUrl,true);
            xmlHttp.setRequestHeader('Authorization', 'Bearer '+accessToken);
            xmlHttp.responseType = "json";
            xmlHttp.onload = function () {
                if (xmlHttp.readyState === xmlHttp.DONE) {
                    if (xmlHttp.status === 200) {
                        var d = xmlHttp.response.datasets;
                        var r = xmlHttp.response.reports;
                        if (r != 0 &amp;amp;&amp;amp; d != 0) {
                            console.log('---------------start updating parameter----------------')
                            reportId = r[0].id;
                            console.log(reportId);
                            datasetId = d[0].id;
                            console.log(datasetId);
                            embUrl = r[0].embedUrl;
                            clearInterval(set_interval_id);
                            var changeParamUrl = "https://api.powerbi.com/v1.0/myorg/groups/" + groupId + "/datasets/" + datasetId + "/Default.UpdateParameters";
                            changeParam(changeParamUrl, accessToken, paramData, datasetId)
                            console.log('---------------finished updating parameter----------------')
                        } else {
                            run_getDataset_Report(accessToken)
                        }
                    }
                    else{
                        removeLoading();
                    };
                }
                }
            xmlHttp.send();
        }

        function changeParam(theUrl,accessToken,paramData, datasetId) {
            console.log(paramData);
            xmlHttp.open("POST",theUrl,true);
            xmlHttp.setRequestHeader('Authorization', 'Bearer '+accessToken);
            xmlHttp.setRequestHeader("Content-type","application/json");
            xmlHttp.onload = function () {
                if (xmlHttp.readyState === xmlHttp.DONE) {
                    if (xmlHttp.status === 200) {
                        console.log('---------------start refreshing datasets----------------')
                        var getDatasourceUri = "https://api.powerbi.com/v1.0/myorg/groups/"+ groupId +"/datasets/" + datasetId + "/datasources"
                        getDatasourceInfo(getDatasourceUri, accessToken, paramData, datasetId)
                        console.log('---------------finished refreshing datasets----------------')
                    }
                    else{
                        removeLoading();
                    };
                    }
            }
            xmlHttp.send(paramData);
        };&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now the strange thing about this problem is I have 3 reports, 2 already existed reports and 1 new report.&lt;/P&gt;&lt;P&gt;this problem only occurred on my new report which I'm trying to publish.&lt;/P&gt;&lt;P&gt;when I use this code to update the parameter on the other two it works just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now, I also compared the settings between my new report and the old one:&lt;/P&gt;&lt;P&gt;1. both already have the parameter "Enabled Load" checked&lt;/P&gt;&lt;P&gt;2. both are being released by the same application user, which have admin permission&lt;/P&gt;&lt;P&gt;3. both are being released to the same powerBI workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the only difference that I could think of is my new report is created &lt;STRONG&gt;after&amp;nbsp;&lt;/STRONG&gt;I updated my powerBI desktop,&lt;/P&gt;&lt;P&gt;but I don't think it would have any effects or whatsoever on this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any insight would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bests,&lt;/P&gt;</description>
      <pubDate>Sat, 01 Aug 2020 07:48:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/InvalidRequest-Error-when-updating-dataset-parameter-only-on-a/m-p/1266119#M25031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-01T07:48:13Z</dc:date>
    </item>
  </channel>
</rss>

