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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
toovishant
Helper II
Helper II

What details required to connect REST API to Power BI

Hi All,

Here are the Rest API details I have and unable to connect, not sure I follow the rest steps to connect. Please help.

curl -X 'GET' \  'https://---------------------/GetAllBuildingsPublicBasic?PageNumber=1&PageSize=5000' \  -H 'accept: */*' \  -H 'x-api-key: ---------------' 

 Any help apperciated.

Thank You

Vishant

1 ACCEPTED SOLUTION
kushanNa
Super User
Super User

Hi @toovishant 

 

click get data > blank query > advanced editor > copy and past the following code and fill it up with the url and api key > click edit credentials > pick Anonymous > connect and see if it works ? 

 

let
    Source = Json.Document(Web.Contents("https://---------------------/GetAllBuildingsPublicBasic?PageNumber=1&PageSize=5000",
        [
            Headers = [
                #"accept" = "*/*",
                #"x-api-key" = "---------------"
            ]
        ]
    ))
in
    Source

 

View solution in original post

8 REPLIES 8
kushanNa
Super User
Super User

Hi @toovishant 

 

click get data > blank query > advanced editor > copy and past the following code and fill it up with the url and api key > click edit credentials > pick Anonymous > connect and see if it works ? 

 

let
    Source = Json.Document(Web.Contents("https://---------------------/GetAllBuildingsPublicBasic?PageNumber=1&PageSize=5000",
        [
            Headers = [
                #"accept" = "*/*",
                #"x-api-key" = "---------------"
            ]
        ]
    ))
in
    Source

 

You Rock My Friend @kushanNa - It worked like a magic.

I think there are other steps to get the data. Please can you proivde if possible.

toovishant_0-1747891460968.png

 

No worries , click list > to table > ok > click expand column button and see if it expands the data ? 

 

or try this code 

 

let
    // Get the raw JSON
    Source = Json.Document(Web.Contents("https://---------------------/GetAllBuildingsPublicBasic?PageNumber=1&PageSize=5000",
        [
            Headers = [
                #"accept" = "*/*",
                #"x-api-key" = "---------------"
            ]
        ]
    )),

    // Navigate to the "value" key which contains the list
    ValueList = Source[Value],

    // Convert list to table
    ToTable = Table.FromList(ValueList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

    // Expand the records into columns
    Expanded = Table.ExpandRecordColumn(ToTable, "Column1", {"Name", "Value"})

in
    Expanded

 

Hey @kushanNa  - What if I want to connect via the api key what details and steps required?

Should I go via the Connect data >Web>Web API

not sure what details need to enter in "Key", As mentioned earlier I have these details.

curl -X 'GET' \  'https://---------------------/GetAllBuildingsPublicBasic?PageNumber=1&PageSize=5000' \  -H 'accept: */*' \  -H 'x-api-key: ---------------' 

toovishant_2-1747917669602.png

 

Thank You

 

To the best of my knowledge, the 'key' is typically used with a general header like 'Authorization', but in your case, you’re using a custom header like 'x-api-key'

It worked Thank You @kushanNa .

toovishant
Helper II
Helper II

I get the follow error when i try to use WEB and API key, I am using the right details to autheticate and connect API?

 

toovishant_0-1747816713727.pngtoovishant_1-1747816855590.png

 

Gabry
Super User
Super User

Hey, what's your issue? M code should look like this:

 

let
    url = "https://---------------------/GetAllBuildingsPublicBasic?PageNumber=1&PageSize=5000",
    apiKey = "---------------",
    response = Web.Contents(url,
        [
            Headers = [
                #"accept" = "*/*",
                #"x-api-key" = apiKey
            ]
        ]
    ),
    json = Json.Document(response)
in
    json

It should work

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.