March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello
So, API's totally baffle me, could do with some help.
I am never sure whether to use getdata, then is it web, json, and then there if several options, signing in, providing key that never seems to work.
So, first, do I use Desktop or Service as the options seems to be there for desktop but what I 've read so suggest Service?
https://gcc.azure-api.net/echo/resource[?param1][¶m2]
after that there is this
What do I do next?
Ross
Hi @rosscortb ,
Do the suggestions from engineers make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.
Best regards
Amy
Hello @v-xicai
I understand most of the answer, I think the issue I have is understanding the practical steps to getting the info.
Thanks
Ross
Web APIs work on two main principles
1. GET - you have a URL that may contain parameters. You use Web.Contents with the URL and get your data back from that server. Oftentimes the response is in JSON format that you then need to parse. You can run these steps separately or pipe them together. As you mentioned sometimes these servers require you to authenticate or to add othe header information.
...
URL = "http://xxx/tstat",
headers = [#"Content-Type"="application/json"],
web = Web.Contents(URL, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web),
#"Converted to Table" = Record.ToTable(result)
...
2. PUT - this is when you have secret data like a password that you don't want to send in clear text, or commands and data that you want to send TO the API server. That requires you to prepare the payload, and put it in the request body. An example is here
...
URL = "http://xxx/tstat",
headers = [#"Content-Type"="application/json"],
data = Json.FromValue([tmode = 2,t_cool = Setpoint,hold = 0]),
web = Web.Contents(URL, [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web),
#"Converted to Table" = Record.ToTable(result)
...
You see that there's no way to specify GET or PUT - instead the presence of a non-empty Content will automatically change the method from GET to PUT. The Json.FromValue part here has a lot of pixie dust - not only does it convert the parameters into usable format but it also binary encodes the payload.
This all happens in Power Query which works the same on the Power BI desktop and on the service (when you refresh your dataset it will run all the included Power Query scripts).
Your example is a GET request with a URL that has some dynamic parameters. You can concatenate the URL string yourself, or use the Query= function to swap your parameter values in as needed.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |