Forum Discussion
Another Web Scraping Query
Hi , jmillsjmills
According to your description, you want your Http request to return a string in JSON format. Right?
First , you can put your request and request parameters into the "Postman" tool for debugging and see if it returns JSON format.
Second, you can try adding in the "Headers"
Accept=application/json
For how to add "Headers" in Web.Contents , you can refer to :
Web.Contents - PowerQuery M | Microsoft Learn
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- jmillsjmills3 years agoHelper III
Thanks so much for coming back Aniya!
Sorry, I'm not quite following. Are you able to test on your side whether you can pull this data in? The link you've provided exactly the sort of thing I've been playing with but I simply cannot work out how to pull the data.
If you are able to kindly provide what the Power Query code would need to be exactly in this instance, I would be so very grateful!
Thank you so SO much!
- v-yueyunzh-msft3 years agoCommunity Support
Hi , jmillsjmills
This url is your internal , i cannot test in my workaround, but you can try to use this and replace the url for yours to test .
let url = "https://www.betfred.com/services/SportsBook/event?language=uk&type=event&eventid=22385490.2&dataflag...[your url should replace here]", headers = [#"Accept"="application/json"], response = Web.Contents( url, [ Headers = headers ] ), jsonResponse = Json.Document(response) in jsonResponseThank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- jmillsjmills3 years agoHelper III
Thanks so much for this Aniya but I'm afraid I'm getting a similar message to before:
It can't seem to read this source code and is insisting that it is HTML.. Do you have any other ideas at all please? Was the above working for you? I inputted https://www.betfred.com/services/SportsBook/event?language=uk&type=event&eventid=22385490.2&dataflags=14&datasize=8&cachebust=1668982826349 in place of your URL
Thanks