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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
abartozzi
Frequent Visitor

Fetch data from a web source

hi PBI community, have to seek help for this one. 

 

So i need to set up a call to this api.

 

https://data.xotelo.com/api/rates?hotel_key=g297930-d305178&chk_in=2021-03-25&chk_out=2021-03-26

 

After changing with a function all relevant parts in order to obtain data what the api returns is something like this:

 

abartozzi_0-1614793122347.png

it should be a sort of JSON format response however the format seems not suitable to be fetched by power bi:

 

abartozzi_1-1614793226675.png

abartozzi_2-1614793247384.png

I also tried to use the "add table based on example" however it says that it canìt find any CSS selector for example values. 

Hence it's impossible to get any data out of this. 

 

Do you know any way I can work out a solution?

 

thank you

Alberto 

 

 

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @abartozzi 

 

Download example PBIX with the following code

 

The JSON returned from the API is valid.  To get it you can wrap the Web.Contents function in Json.Document like this

let
    Source = Json.Document(Web.Contents("https://data.xotelo.com/api/rates?hotel_key=g297930-d305178&chk_in=2021-03-25&chk_out=2021-03-26")),
    result = Source[result],
    #"Converted to Table" = Record.ToTable(result)
in
    #"Converted to Table"

jsondata.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hello, I found a web page that contains some data that interests me but is visualized with power BI. How do I get that data and upload it to my power BI?

PhilipTreacy
Super User
Super User

Hi @abartozzi 

 

Download example PBIX with the following code

 

The JSON returned from the API is valid.  To get it you can wrap the Web.Contents function in Json.Document like this

let
    Source = Json.Document(Web.Contents("https://data.xotelo.com/api/rates?hotel_key=g297930-d305178&chk_in=2021-03-25&chk_out=2021-03-26")),
    result = Source[result],
    #"Converted to Table" = Record.ToTable(result)
in
    #"Converted to Table"

jsondata.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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