Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Unable to send request body using Web data source for REST API

Hi ,

I am not able to connect to an API by sending request body.

 

When I covert it into Power BI query format 

2017-11-06_14-19-05.png

 

 

let
body="items.find({""repo"" : ""maven-prereleases-local""},{""@PL000003_RELEASE"" : {""$match"" : ""*17*""}}).include(""repo"",""path"",""name"",""created"",""updated"",""@PL000003_RELEASE"")",
Source = Json.Document(Web.Contents("https://artifactory.xyz.com/api/search/aql", [Content=Text.ToBinary(body)]))

in
Source

 

I am getting error as

DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.
Details:
DataSourceKind=Web
DataSourcePath=https://artifactory.xyz.com/api/search/aql

 

If Connect anonymously then my api will fail authentication.

Is there a problem with sending request body with api?

Status: New
Comments
Eric_Zhang
Microsoft Employee

@belurrashmi

What kind of that authentication?

Power Query would definitely not pop up any login window, you shall integrate authentication in the Power Query as well. See a twitter demo.

belurrashmi
Frequent Visitor

@Eric_Zhang

I am using basic authentication

 

I also tried using this way no success, 

 

let
body="items.find({""repo"" : ""maven-prereleases-local""},{""@PL000003_RELEASE"" : {""$match"" : ""*17*""}}).include(""repo"",""path"",""name"",""created"",""updated"",""@PL000003_RELEASE"")",
Source = Json.Document(Web.Contents("https://artifactory.xyz.com/api/search/aql", [Headers=[Authorization="(base64-encoded Username:PWd)"],Content=Text.ToBinary(body)]))

in
Source