1
votes

I've discovered the hard way that PowerQuery (Powerbi & excel) Web.Contents function doesn't support a body payload when using Windows authentification.

enter image description here enter image description here

with similar query

let
   body = "{""json"" : ""payload""}",
   Data= Web.Contents("http://xxxx/api/Query",[Content=Text.ToBinary(body),Headers=[#"Content-Type"="application/json"]]),
   DataRecord = Json.Document(Data)
   ...

pretty stocked this lonely support and I suspect I'm missing an important aspect. Is there a recommanded way ? My google search were pretty un-successful.

Should I generate some kind of token with a first GET and then make a POST with body + token in anonymous ?

1

1 Answers

0
votes

Do you have to use Windows authentication? How about using something like this with Anonymous authentication:

let 
AuthKey = "mytoken",
url="http://xxxx/api/Query",
body = "{""json"" : ""payload""}",

Source = Json.Document(Web.Contents(url,[
          Headers = [#"Authorization"=AuthKey ,
                #"Content-Type"="application/json"],
        Content = Text.ToBinary(body)
        ]
    ))

 in
    Source

Will this solve your problem?