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
anandsharma
New Member

Getting Error while updating datasource using Rest APIs

I was trying to update Datasource path for Dataverse dataset using rest api but getting error while using below payload

payload = {
  "updateDetails": [
    {
      "datasourceSelector": {
        "datasourceType":"Extension",
        "connectionDetails":{
        "path":"abc.crm8.dynamics.com",
        "kind":"CommonDataService"
      },
      "datasourceId":"10400158-2269-42a8-9f22-95745d551cee",
      "gatewayId":"960c0756-6d6f-45f1-9977-82703c510ea7"
      },
      "connectionDetails": {
          "path""def.crm8.dynamics.com",
          "kind":"CommonDataService"
      }
    }]}
Error msg is ::  Parameter UpdateDetails is missing or invalid
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@anandsharma .I am glad to help you.
Due to my work environment, I was unable to use a dataverse data source that replicates your actual environment, so I implemented this API using a SQL Server database:

Datasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

This API enables you to modify the data source by modifying the value of a parameter in your report.
1. You need to create a parameter to store the data source information for your report.
I named it DatabaseName, and the parameter value is AdventureWorksDW2017.

vjtianmsft_0-1729151501386.png

vjtianmsft_1-1729151510805.png

2. You need to use this parameter in your power query Advanced Editor to replace the original data source name to get the data source (the use of the parameter can make the management of the data source more convenient, you only need to change the data source parameter to modify the data source, which is also the work of the implementation of this API)

vjtianmsft_2-1729151556172.png


After publish to Power BI Service, you can see that the original data source is AdventureWorksDW2017.


vjtianmsft_3-1729151591513.png

Meanwhile I successfully configured the gateway connection

vjtianmsft_4-1729151622518.png


copy the power BI service web url groupID:

vjtianmsft_5-1729151659746.png


You need to get the ID of the DataSet used by the report you want to modify.
Use another API:
Datasets - Get Datasets In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

This API is a get request, you need to enter the groupID you just entered to get to this DataSet.


vjtianmsft_6-1729151779838.png


After the API runs successfully, find the corresponding report that needs to be modified and copy the corresponding id value (DataSetID).


vjtianmsft_7-1729151807042.png


Use the API that I recommend for you:
Datasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn


vjtianmsft_8-1729151858988.png

JSON post request body:

Retrieve the parameter defined in the report: “DatabaseName”, change the value of the parameter
representing the data source to the new data source you need to modify.

 

{
  "updateDetails": [
    {
      "name": "DatabaseName",
      "newValue": "AdventureWorksDW2022"
    }
  ]
}

 

vjtianmsft_9-1729151919903.png


After a successful run, refresh your browser and subsequently go back to the Power BI Service and view the report's data source, where the modification has successfully occurred (the parameter was modified successfully)

vjtianmsft_11-1729152441190.png

 

Since I had previously created separate gateway connections for both databases (2017 and 2022), the system automatically changed the database gateway connections when it detected a change in the data source (switching to database 2022)

vjtianmsft_10-1729152025507.png

The data source was successfully modified by using the API (by modifying the data source parameters)

I hope my test will give you good advice, I have also uploaded my test file.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,@anandsharma .I am glad to help you.
Due to my work environment, I was unable to use a dataverse data source that replicates your actual environment, so I implemented this API using a SQL Server database:

Datasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

This API enables you to modify the data source by modifying the value of a parameter in your report.
1. You need to create a parameter to store the data source information for your report.
I named it DatabaseName, and the parameter value is AdventureWorksDW2017.

vjtianmsft_0-1729151501386.png

vjtianmsft_1-1729151510805.png

2. You need to use this parameter in your power query Advanced Editor to replace the original data source name to get the data source (the use of the parameter can make the management of the data source more convenient, you only need to change the data source parameter to modify the data source, which is also the work of the implementation of this API)

vjtianmsft_2-1729151556172.png


After publish to Power BI Service, you can see that the original data source is AdventureWorksDW2017.


vjtianmsft_3-1729151591513.png

Meanwhile I successfully configured the gateway connection

vjtianmsft_4-1729151622518.png


copy the power BI service web url groupID:

vjtianmsft_5-1729151659746.png


You need to get the ID of the DataSet used by the report you want to modify.
Use another API:
Datasets - Get Datasets In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

This API is a get request, you need to enter the groupID you just entered to get to this DataSet.


vjtianmsft_6-1729151779838.png


After the API runs successfully, find the corresponding report that needs to be modified and copy the corresponding id value (DataSetID).


vjtianmsft_7-1729151807042.png


Use the API that I recommend for you:
Datasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn


vjtianmsft_8-1729151858988.png

JSON post request body:

Retrieve the parameter defined in the report: “DatabaseName”, change the value of the parameter
representing the data source to the new data source you need to modify.

 

{
  "updateDetails": [
    {
      "name": "DatabaseName",
      "newValue": "AdventureWorksDW2022"
    }
  ]
}

 

vjtianmsft_9-1729151919903.png


After a successful run, refresh your browser and subsequently go back to the Power BI Service and view the report's data source, where the modification has successfully occurred (the parameter was modified successfully)

vjtianmsft_11-1729152441190.png

 

Since I had previously created separate gateway connections for both databases (2017 and 2022), the system automatically changed the database gateway connections when it detected a change in the data source (switching to database 2022)

vjtianmsft_10-1729152025507.png

The data source was successfully modified by using the API (by modifying the data source parameters)

I hope my test will give you good advice, I have also uploaded my test file.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

anandsharma
New Member

I want to just update path for the given Dataverse dataource. How can we write it in paramter form?

Anonymous
Not applicable

Hi,@anandsharma . I am glad to help you.
Based on the content of the body of the post request you sent in json format, it appears that you are using this Power BI Rest API.
URL:
Datasets - Update Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

vjtianmsft_0-1729129630345.png

If this is indeed the RestAPI, I note that the API limitations state that it only supports certain data source types.
Like this:

vjtianmsft_1-1729129661972.png

The datasource type you need to modify is Dataverse .
Dataverse is not in this list of supported datasource types. This means that if you want to update a Dataverse datasource, you should use the Update Parameters In Group API.
URL:
Datasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn
 

vjtianmsft_2-1729129724733.png

The Update Parameters In Group API has no specific data source type restrictions, so you can use this API to update all types of data sources, including Dataverse.

When using this API, you need to be aware of the following:
User permissions: The requesting user must be the owner of the dataset, or use a service subject profile with appropriate permissions.
Call Scope: The permission scope of Dataset.ReadWrite.All is required.

If my understanding is wrong, please let me know and upload the official Rest API documentation you are using.
Please check the scenario you are using for your API request, whether it is for Power BI Service, or Power BI Report Server, these two different service scenarios use different kinds of APIs, to avoid using the wrong classification of Rest API.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.