PowerBI API Rest API for updating the Datasource ID

0 votes
PowerBI API Rest API for updating the Datasource ID?

I'm working on a project that requires updating the data source ID for a dataset in Power BI, and I understand that this can be achieved using the Power BI REST API. Specifically, I need to understand how to authenticate, access, and utilize the correct API endpoints to update the data source ID efficiently without manual intervention through the Power BI interface.

Is there a step-by-step guide or best practices on using the REST API for this task? If so, I’d appreciate guidance on setting up authentication, finding the data source ID, and executing the API calls to automate this update process.
Oct 29, 2024 in Power BI by Evanjalin
• 19,000 points
107 views

1 answer to this question.

0 votes

To replace the data sourced in Power BI via REST API, here’s what you should do:

  • Get the Dataset ID: First of all, make sure you have the datasetId of the Power BI dataset which you want to change. You can achieve that by calling:
GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets

In this case, you need to replace the {groupId} with your workspace ID. 

  • Identify the Current Data Source: After obtaining the datasetId, verify the available data sources by invoking the following:
GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/datasources

A consequence of the preceding is that it generates the data sources tied to that particular dataset such as the one with the datasourceId that you would like to change.

  • Datasource Updating: In case you wish to change the proposed datasourceId, do the following request and provide details regarding the new data source in the body:
PATCH https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateDatasources
  • Authentication: Always bear in mind that use of the Power BI REST API means use of OAuth 2.0. Make sure that the app has been granted the needed permissions (Dataset.ReadWrite.All) and a token has been received before attempting to make any requests.

These steps will assist you in successfully changing the datasourceId for a dataset present in Power BI.

answered Oct 29, 2024 by pooja
• 16,780 points
0 votes
  • 1. Authenticate—First, we can use Azure AD to get the access token related to the API permissions (Dataset.ReadWrite.All).
  • 2. Get Dataset ID - Now we can use GET /groups/{groupId}/datasets to list their datasets.
  • 3. Get Data Source ID - Now we can get data source details using GET /groups/{groupId}/datasets/{datasetId}/data sources.
  • 4. Update Data Source - Now, we can use POST /groups/{groupId}/datasets/{datasetId}/data sources to update the data source ID.
  • 5. Automate - Use HTTP calls or scripts with tokens to facilitate the automation.
answered Dec 3, 2024 by anonymous
• 3,440 points

edited 5 days ago

Related Questions In Power BI

0 votes
0 answers

PowerBI API Rest API for updating the Datasource ID?

PowerBI API Rest API for updating the ...READ MORE

Oct 25, 2024 in Power BI by Evanjalin
• 19,000 points
89 views
0 votes
1 answer

What is the process for updating key credentials of a Databricks data source via the Power BI REST API?

Updating Databricks Credentials in Power BI via ...READ MORE

answered Feb 27 in Power BI by anonymous
• 19,000 points
49 views
0 votes
1 answer

Why am I getting a 401 Unauthorized error when renaming a Power BI dataflow using the Power BI REST API, and how can I fix it?

A 401 Unauthorized error when renaming a ...READ MORE

answered Feb 27 in Power BI by anonymous
• 19,000 points
110 views
0 votes
1 answer

Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,520 views
+1 vote
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 22, 2018 in Power BI by nirvana
• 3,130 points
2,869 views
+2 votes
2 answers

Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

answered Oct 11, 2018 in Power BI by Hannah
• 18,520 points
1,649 views
+1 vote
1 answer

Connect power bi desktop to dataset and create custom reports

Open power bi report nd sign in ...READ MORE

answered Oct 10, 2023 in Power BI by Monika kale

edited 6 days ago 1,795 views
0 votes
0 answers
0 votes
1 answer

How can I leverage the Power BI REST API for automated report deployment and management within my organization?

To ensure easier deployment and maintenance of ...READ MORE

answered Nov 14, 2024 in Power BI by pooja
• 16,780 points
119 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP