cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
belurrashmi Frequent Visitor
Frequent Visitor

How to include header in the web data source?

I  am trying to get data from a api source and it requires header  X-Result-Detail=info,properties.

What is the best way to pass this parameter with Basic authentication?

I get error that the above header requires anonymous authentication, if I choose anonymous my api wont authnticate to give results.

Please help

8 REPLIES 8
Community Support Team
Community Support Team

Re: How to include header in the web data source?

@belurrashmi,

 

You may take a look at The Advanced Editor and take advantage of API key when using Web.Contents.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
belurrashmi Frequent Visitor
Frequent Visitor

Re: How to include header in the web data source?

@v-chuncz-msft thank you for reply.

I saw some posts with the examples and tried, Apikeyname works with anonymous login thats my error message.

I am using basic authentication here for api login then I was to pass custom header.

In the advanced editor section when I provide custom headers I get error "Expression.Error: The 'X-Result-Detail' header is only supported when connecting anonymously. These headers can be used with all authentication types: Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, If-Modified-Since, Prefer, Referer"

belurrashmi Frequent Visitor
Frequent Visitor

Re: How to include header in the web data source?

I changed my way to get the content my request works in the below format,

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 get error as Expression.Error: The name 'Content' wasn't recognized.  Make sure it's spelled correctly.

 

Why is that?

 

 

 

Community Support Team
Community Support Team

Re: How to include header in the web data source?

@belurrashmi,

 

You need to specify the value as a record.

[Content=Text.ToBinary(body)]
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
belurrashmi Frequent Visitor
Frequent Visitor

Re: How to include header in the web data source?

After fixing the content value, 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

 

@v-chuncz-msft do you have any thoughts on this issue. 

making anonymous login will fail authentication from the api side

Community Support Team
Community Support Team

Re: How to include header in the web data source?

@belurrashmi,

 

Edit permissions in data source settings and try again.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
belurrashmi Frequent Visitor
Frequent Visitor

Re: How to include header in the web data source?

As I mentioned earlier, after changing the authentication to anonymous login will fail authentication from the api side.

Community Support Team
Community Support Team

Re: How to include header in the web data source?

@belurrashmi,

 

You may also try to create a support ticket.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors