Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hello,
I'm trying to use the Advanced Editor to make an API call for the first time. I've watched Chris Webb's excellent video on the subject and took a bunch of notes, but i'm missing something here. In the video, I noted his call as:
let
Source = Web.Contents("https://baseURL",
[
RelativePath="hello",
Query = [
key = "value1"
key = "value2"
],
ApiKeyName = "apikeyskdjf;asdkfj]"])
]
)
in
SourceBut my query parameters didn't like this format.
The call I'm trying to make is a GET request:
let
Source = Web.Contents(
"https://somecompanysAPI.com/v2/",
[
RelativePath="historical",
Query =
{
"geocode": {
"lon": -122.31177520752,
"lat": 47.4498901367188
},
"location_id": "",
"start_time": "2017-11-01T12:00:00Z",
"end_time": "2017-11-07T12:00:00Z",
"timestep": 60,
"fields": [
{"name": "temp", "units": "F"},
{"name": "feels_like", "units": "F"},
{"name": "dewpoint", "units": "F"},
{"name": "wind_speed", "units": "mph"},
{"name": "wind_gust", "units": "mph"},
{"name": "baro_pressure", "units": "inHg"},
{"name": "visibility", "units": "km"},
{"name": "precipitation", "units": "in/hr"},
{"name": "cloud_cover", "units": "%"},
{"name": "cloud_ceiling", "units": "ft"},
{"name": "cloud_base","units": "ft"},
{"name": "humidity", "units": "%"},
{"name": "wind_direction", "units": "degrees"},
{"name": "precipitation_type"},
{"name": "sunrise"},
{"name": "sunset"}
]
}
ApiKeyName = "thisisnotreallymyAPIkeydude"
]
)
in
SourceCan someone with more experience see what I'm missing here as far as syntax goes?
Thank yoU!
Solved! Go to Solution.
Ok! I figured this out from the great example in the Forums found here: https://community.powerbi.com/t5/Desktop/Connect-to-a-Web-Service-sending-parameters/m-p/295990#M130.... Thank you @Anonymous!
Here is what I ended up going with:
let
url = "https://company.com/api/path",
headers = [
#"apikey" = "thisisnotreallymyapikey",
#"accept" = "application/json",
#"Content-Type" = "application/json"
],
content = "{
""key"": {
""nestedKey"": value,
""nestedKey"": value
},
""key"": """",
""key"": ""value"",
""key"": ""value"",
""key"": value,
""key"": [
]
}",
webdata = Web.Contents(url, [Headers=headers,Content = Text.ToBinary(content)]),
response = Json.Document(webdata)
in
responseWhew! I should have searched the forums better! NOTED 🙂
Still needing some assistance here. I've boiled down the code a bit to make it easier to read. Can you see why this is not working?
I should be more clear here on what I'm looking for help with:
Method: POST
Authentication: API Key sent in Request Header
Parameterized Request?: No, JSON request, not a parameterized URL
Body: JSON
Request Headers?: Yes, 3 (apikey, accept, Content-Type)
Response: JSON
Response Headers?: Yes, 11 (though I don't think I need to craft the response headers, they should auto)
Error in Advanced Editor: "Invalid Identifier" error on the word "geocode".
I've tried "Query" and "Content" in the below M with no success. The docs on Web.Contents have NO examples (and the Github contribute link is broken on that site!). For some reason, not many people are making POST requests with PowerBI so there are like NO examples of this on the internet besides Chris Webb's video. But I can't glean how to do it from his video (@ ~24:54 mark) because he digresses a bit at EXACTLY the moment he covers POST requests!
let
Source = Web.Contents(
"https://somecompanysAPI.com/v2/historical",
[
Query = [
"geocode": {
"lon": -122.31177520752,
"lat": 47.4498901367188
},
"location_id": "",
"start_time": "2017-11-01T12:00:00Z",
"end_time": "2017-11-07T12:00:00Z",
"timestep": 60,
"fields": [
],
ApiKeyName = "thisisnotreallymyAPIkeydude"
]
)
in
SourceDoes anyone have insights on this? An example or two of how you do it?
Thank you very much!
Ok! I figured this out from the great example in the Forums found here: https://community.powerbi.com/t5/Desktop/Connect-to-a-Web-Service-sending-parameters/m-p/295990#M130.... Thank you @Anonymous!
Here is what I ended up going with:
let
url = "https://company.com/api/path",
headers = [
#"apikey" = "thisisnotreallymyapikey",
#"accept" = "application/json",
#"Content-Type" = "application/json"
],
content = "{
""key"": {
""nestedKey"": value,
""nestedKey"": value
},
""key"": """",
""key"": ""value"",
""key"": ""value"",
""key"": value,
""key"": [
]
}",
webdata = Web.Contents(url, [Headers=headers,Content = Text.ToBinary(content)]),
response = Json.Document(webdata)
in
responseWhew! I should have searched the forums better! NOTED 🙂
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 36 | |
| 31 | |
| 29 | |
| 26 |