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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Unable to change parameter using Rest API

Hi, I am facing an issue while trying to change Report parameter values on power bi service using api request call using the syntax provided in the power bi documentation.

 

The query that I am sending using python is as below 

 

dest = 'https://api.powerbi.com/v1.0/myorg/groups/' + self.group_id + '/datasets/' + self.dataset_id + '/Default.UpdateParameters'
headers = {'Authorization': 'Bearer ' + self.access_token}
data = {"updateDetails": [{"name": "ScenarioID","newValue": "110"},{"name":"ChildID","newValue":"13"}]}

Param = requests.post(dest, data=data, headers=headers)

 

Which is giving me below response

 

{'error': {'code': 'InvalidRequest',
'message': 'Dataset Parameters list is invalid in DatasetID. Reason: Invalid parameter update details',
'target': 'DatasetID'}}

 

I am unable to understand how to resolve this I have parameters defined as 

 

Required box ticked.

Type Decimal Number (I have tried it with text type as well)

suggested values: any

Current Value 108

 

Please help!

 

 

3 REPLIES 3
aramirez7
Frequent Visitor

Try this:

dest = 'https://api.powerbi.com/v1.0/myorg/groups/' + self.group_id + '/datasets/' + self.dataset_id + '/Default.UpdateParameters'

 

body= {
"updateDetails": [
{
"name": "DataBase",
"newValue": "myDB"
},
{
"name": "Server",
"newValue": "123.456.789"
}
]
}

header = {'Content-Type': 'application/json'
,'Authorization': f'Bearer {tokenPBI}', 'Accept': 'text/plain'}

 

 

requests.post(dest,
data=json.dumps(body),
headers=header
)

 

 

Regards

 

Anonymous
Not applicable

It seems quite a trivial problem but I am unable to figure out the solution.

 

Please help as it is quite important for my client.

Anonymous
Not applicable

@v-qiuyu-msft  any suggestions

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.