Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

InvalidRequest Error when updating dataset parameter only on a particular report

Hi,

 

I'm having trouble with updating dataset parameter on my report.

the process itself is quite simple :

1. request an oauth token

2. publish my template to power bi service

3. get the published dataset and report ID

4. update parameter on the published report's dataset

 

this is the code that I'm using :

 

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 && 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);
        };

 

 

 

now the strange thing about this problem is I have 3 reports, 2 already existed reports and 1 new report.

this problem only occurred on my new report which I'm trying to publish.

when I use this code to update the parameter on the other two it works just fine.

 

now, I also compared the settings between my new report and the old one:

1. both already have the parameter "Enabled Load" checked

2. both are being released by the same application user, which have admin permission

3. both are being released to the same powerBI workspace

 

the only difference that I could think of is my new report is created after I updated my powerBI desktop,

but I don't think it would have any effects or whatsoever on this problem.

 

any insight would be greatly appreciated.

 

bests,

0 REPLIES 0

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.