Forum Discussion
LeonardSchwenk
4 years agoFrequent Visitor
REST API CALL in function wont work due to invalid input
My function looks like the following. = (playerId as text) as table=>
let
Source = Json.Document(
Web.Contents(
"https://api.greatAPI.io/v1/",
[
...
- 4 years ago
Hi LeonardSchwenk ,
the Web.Contents function only accepts 2 parameters. So you have to nest the records into one like so:(playerId as text) as table=> let Source = Json.Document( Web.Contents( "https://api.greatAPI.io/v1/", [ RelativePath ="players/" & (playerId) , Headers= [ Accept="application/json", Authorization="Bearer XXXXXXXXXXXXXXX" ] ])) in #"Source" - 4 years ago
Hi LeonardSchwenk ,
no, it's not.
There is no opening square bracket before "Headers" for example.
I'd recommend to try it out.
ImkeF
4 years agoCommunity Champion
Hi LeonardSchwenk ,
the Web.Contents function only accepts 2 parameters. So you have to nest the records into one like so:
(playerId as text) as table=>
let
Source = Json.Document(
Web.Contents(
"https://api.greatAPI.io/v1/",
[
RelativePath ="players/" & (playerId)
,
Headers=
[
Accept="application/json", Authorization="Bearer XXXXXXXXXXXXXXX"
]
]))
in
#"Source"LeonardSchwenk
4 years agoFrequent Visitor
ImkeF Maybe im missing something but thats the query I posted. How do I nest the parameters then ?
Thanks