Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 18037

How to update the datasource target odata url using the powerbi rest api

$
0
0

We currently deploy the same dashboard to multiple environments, (ie, dev, test, prod). These dashboards all pull from an odata api so the URL for the target data willl change for each environment. So for the deployment process we use the rest api to upload the pbix files, but also want to change the api target url for the dashboard based on the environment it is being deployed too.

 

In trying to use the "updatedatasource" rest api call it states this can be used for an odata feed to update it, but gives no example for this. I have been trying to get this to work with the api it gives a 500 error or a 400 bad request based upon different tries to make this work. From other discussion boards, this may not even be possible. And trying to find a decent example out there for this so far has been a futile effort. I have done this successfully using direct query dashboards which require a user/password. So I understand how to use the api successfully but for the updatedatasource have been unsuccessful with changing a url.

 

So was wondering if anyone has done this and can share some code. And maybe is this even possible and as per below url it makes me think it might not even be possible. Thanks.

https://community.powerbi.com/t5/Integrations-with-Files-and/How-to-refresh-using-REST-API-with-OAuth2/td-p/59014/page/2

 

Microsoft updatedatsource info

https://msdn.microsoft.com/en-us/library/mt814715.aspx#request

 

Below is the url and code example I have been using.

POST https://api.powerbi.com/v1.0/myorg/groups/{mygroupidhere}/datasets/{mydatasetidhere}/updatedatasources

API - body 

 {
    "updateDetails":[
       {
          "datasourceSelector":
               {
                 "datasourceType": "OData",
                 "connectionDetails":
                        {
                             "url":"https://mydomain.com/mydirectory/odata"
                        }
                }
         }
     ]
}


Viewing all articles
Browse latest Browse all 18037

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>