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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
michaelsh
Kudo Kingpin
Kudo Kingpin

Host Header error in an API call

I have an API call that works in Postman (GET)

It is a OAuth 1.0 authentiacation and I have all keys, secrets and signature.

When I do it in Power Query - I just try to replicate the Headers that Postman.

One of the headers in Postman is "Host" header. Without it - the request doesn't work in Postman. With it - it works.

When I look in Console - it just sends Host: "myurl.com" header.

When I add it in my Power Query request (see in red below) - it suddenly shows an error:

Expression.Error: The 'Host' header must be modified using the appropriate property or method (please see below picture in yellow)

When I click "Edit Settings" - I just get a JSON settings screen - attached.

I tried passing a parameter instead of "myurl.com" - same error.

Other headers don't throw this error.

Without it - it doesn't work either.

Below is the full step code.

Please help!

 

= Json.Document(Web.Contents("https://myurl.com", [
Headers=[
#"Accept" = "application/schema+json",
#"Authorization"= "OAuth realm=""XXXX"",oauth_consumer_key=""YYY"",oauth_token=""TTTT"",oauth_signature_method=""HMAC-SHA256"",oauth_timestamp=""123456"",oauth_nonce=""ZZZZZ"",oauth_version=""1.0"",oauth_signature=""DDDDDD""",
#"Host" = "myurl.com"
],
RelativePath = "/api/v1/student"
]))

 

Screenshot 2020-10-17 154101.png

 

Screenshot 2020-10-17 154101.jpg

 

5 REPLIES 5
Anonymous
Not applicable

I see, thanks for confirming @michaelsh 

michaelsh
Kudo Kingpin
Kudo Kingpin

@Anonymous  No, sorry, I gave up on this Oauth API and went to ODBC instead...

Anonymous
Not applicable

Hi @michaelsh 

 

Were you able to resolve that issue. I'm also struck with this issue:

 

Expression.Error: The 'Host' header must be modified using the appropriate property or method.

michaelsh
Kudo Kingpin
Kudo Kingpin

A little update - I removed the Json.Document, leaving just the Web.Contents part.

I also removed the Accept header.

Same error. Now it I click "Edit Settings" I just see the "From Web" settings where it correctly recognizes my headers.

It just doen't like the "Host" header somehow...

I've played with its values - same error, it just doesn't like this header being there...

Any ideas? Please help...

 

Screenshot 2020-10-17 1541021.jpg

 

Anonymous
Not applicable

Hi @michaelsh,

Have tried to use any other methods to invoke your api? AFAIK, normally power query web connector not required 'host' parameters. Maybe you can try to split the authorizations string to standalone parameters and remove 'host'.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.