Forum Discussion

mridulmathur's avatar
mridulmathur
New Member
3 years ago

DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong

hi all, I am trying to import data from MCX site in excel

but getting below error:

DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server.

 

below is the code, its a post call with Json Payload. i have tried both Json.fromValue and text.tobinary but got similar result:

 

let
Source = Json.Document(Web.Contents("https://www.mcxindia.com/market-data/option-chain", [Content=Json.FromValue([Commodity="CRUDEOIL", Expiry="17OCT2022"]),
Headers=[Cookie="_ga=GA1.2.1341481004.1662073518; device-referrer=; device-source=https://www.mcxindia.com/; ASP.NET_SessionId=hs0aoriiadw3u41bke0pyz4f; _gid=GA1.2.1265856523.1663745533",
#"Content-Type" = "application/x-www-form-urlencoded", #"Accept" = "application/json"]]),TextEncoding.Unicode)
in
Source

1 Reply