The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all
I have this api call:
http://localhost:8080/resto/api/reports/olap?report=SALES&from=01.01.2019&to=18.12.2019&groupRow=WaiterName&groupRow=OpenTime&agr=fullSum&agr=OrderNum
As you can see, keynames "groupRow" and "agr" meet twice in GET-method. I wanna to invoke this api in Power BI using this code:
Data= Web.Contents(
API_SERVER,
[RelativePath = "resto/api/reports/olap",
Query = [report="SALES", from="01.01.2019", to="18.12.2019",groupRow="WaiterName", groupRow="OpenTime", agr="fullSum", agr="OrderNum"]
]
)
But since Query is a record, so it is impossible to use identical record field names.
Is there a workaround? I dont want to use prepared full URL without RelavitePath specified because of URL access credentials (now I set credentianls only for API_SERVER which is http://localhost:8080 in the example above)
Solved! Go to Solution.
I found the final solution, and it is very easy 🙂
Thouse keynames duplicates are the array representations for HTTP request parameters, and they can be easily passed through Query subparameter as M-language List representation, e.g. from my first post example:
Data= Web.Contents(
API_SERVER,
[RelativePath = "resto/api/reports/olap",
Query = [report="SALES", from="01.01.2019", to="18.12.2019",groupRow={"WaiterName", "OpenTime"}, agr={"fullSum", "OrderNum"}]
]
)
The record fields of Query - groupRow and agr - are passed as Lists - and this works 🙂
I found a workaround:
http://localhost:8080/resto/api/reports/olap?report=SALES&from=01.01.2019&to=18.12.2019&groupRow=WaiterName&groupRow=OpenTime&agr=fullSum&agr=OrderNum
becomes as
http://localhost:8080?report=SALES&from=01.01.2019&to=18.12.2019&groupRow=WaiterName&groupRow=OpenTime&agr=fullSum&agr=OrderNum
in Web.Contents invocation, the RelativePath remains the same ("resto/api/reports/olap") and Query subparameter goes away at all.
I discovered that this workaround is good for PBI Desktop, but is too bad for PBI Service sheduler ((
The question remains open
I found the final solution, and it is very easy 🙂
Thouse keynames duplicates are the array representations for HTTP request parameters, and they can be easily passed through Query subparameter as M-language List representation, e.g. from my first post example:
Data= Web.Contents(
API_SERVER,
[RelativePath = "resto/api/reports/olap",
Query = [report="SALES", from="01.01.2019", to="18.12.2019",groupRow={"WaiterName", "OpenTime"}, agr={"fullSum", "OrderNum"}]
]
)
The record fields of Query - groupRow and agr - are passed as Lists - and this works 🙂
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.