Forum Discussion
How to connect a Rest API with variable path parameters as endpoints in URL with Power BI?
- Anonymous4 years ago
HI ANNOAH,
You can create a query aptamer with text type and invoke it in your query table steps, then you can change the query parameter by rest API to dynamic affect the data source target:
let Path = "/name/server/api/" & Parameter, Result = Web.Contents( "https://test.com", [ Headers = [ Authorization = "Bearer " + token, RelativePath = Path ] ] ) in ResultDatasets - Update Parameters In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Xiaoxin Sheng
Sort of. But you need to cheat and hide the fact that you are using dynamic parameters. Otherwise the service will refuse to refresh.
So you need to declare an API call in your connection that works (so the service can see it works) AND that works withot parameters being added. In your case the call would have to go to https://test.com/name/server/api/
Without that you will be limited to desktop refreshes.
Hi Ibendlin,
thank you for your answer!
If I do so, I get a list of hundreds of numbers. But now I would like to get the information for a specific number. How can I invoke the information of this specific number? This is what my extended API call with the variable path parameter would do. The reason I am using such an API is that I do not want to load all the data to Power BI, I just want to invoke the data that I need by the API and use it in Power BI to minimize data load.
Kind regards,
ANNOAH
- Anonymous4 years agoNot applicable
HI ANNOAH,
Did the API support query string? If that is the case, you can consider adding a query option in the web connector:
let Path = "/name/server/api/" & Parameter, Result = Web.Contents( "https://test.com", [ Headers = [ Authorization = "Bearer " + token, RelativePath = Path ], Query = [ id = Parameter2 ] ] ) in ResultRegards,
Xiaoxin Sheng