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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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