Forum Discussion

patoduck's avatar
patoduck
Helper III
8 years ago

POST http(s) request with xml content in Power Query

 

Hi Guys,

  1. The problem to solve: read stocks of a product
  2. Target webpage= https://www.vinmonopolet.no/vmp/Land/Chile/Gato-Negro-Cabernet-Sauvignon-2014/p/295306
    1. Link to stock= "Finn butikk med varen på lager"  (Find a store with stocks) you need to click there.

 

 

 4. The code I'm using is here:

 

let
    Source =
Xml.Document(Web.Contents("https://www.vinmonopolet.no/vmp/store-pickup/295306/pointOfServices",
[Headers=[
Accept= "*/*",
AcceptEncoding= "gzip, deflate, br",
AcceptLanguage= "en-US,en;q=0.9,nb;q=0.8,es;q=0.7,ru;q=0.6",
Connection= "keep-alive",
ContentLength= "123",
ContentType= "application/x-www-form-urlencoded; charset=UTF-8",
Host = "www.vinmonopolet.no",
Origin = "https://www.vinmonopolet.no",
Referer = "https://www.vinmonopolet.no/vmp/Land/Chile/Gato-Negro-Cabernet-Sauvignon-2014/p/295306",
UserAgent= "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
XRequestedWith = "XMLHttpRequest"
 

]]))
in
    Source

 

 

 

But I'm getting the following error:

 

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

 

 

Any ideas about how to solve it:

 

  • Making and call to R scripts using Rseleniun (With docker) Difficult I will love to keep it simple and reproducible to other users.

 

BR

 

/Pato

 

 

5 Replies