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
Anonymous
Not applicable

Making API data sources work in power BI web

So I have a table with parameters for changing date ranges in API call.
I followed answers here and other resources and succesfully managed to gather data iteratively. Then I published my report in workplace and detected that it is not possible to refresh dataset. I googled again, stumbled upon reasons and solutions and tried to implement.
So I have upgraded my function-as-parameter so power BI web should be able to validate url:

let
    Source = (param as text) =>
let
    Source = Json.Document(Web.Contents("api_url_part",
    [
        RelativePath="api_url_part" & some_parameter & "api_url_part" & param,
        Query=
        [
            Headers=[Accept="application/json", Authorization="Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]
        ]
    ]
)),
    by_date = Source[by_date],
    #"Converted to Table" = Record.ToTable(by_date),
    #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table", "Value", {"session_count", "visitor_count", "desktop_visitors_count", "mobile_visitors_count", "tablet_visitors_count"}, {"session_count", "visitor_count", "desktop_visitors_count", "mobile_visitors_count", "tablet_visitors_count"})
in
    #"Expanded Value"
in
    Source

 My other query that iterates API calls:

let
    step_1 = Date_params[date_param],
    step_2 = List.Transform (step_1, func_p()),
in
    step_3

Before I used Relative Path and Query everything worked on PowerBi desktop, only in web I had problems. Now when I run the second query I get this error message:

Expression.Error: 0 arguments were passed to a function which expects 1.
Details:
    Pattern=
    Arguments=List

If I enter parameter manually, first query is able to retrieve data so it means problem lies in and I need to change second query as well but I cannot figure out how.

Thanks in advance!

 

 

1 REPLY 1
Anonymous
Not applicable

I made a mistake, I passed underscore as parameter before, this is actual mistake I get:

An error occurred in the ‘’ query. Expression.Error: We cannot convert a value of type Record to type Text.
Details:
    Value=Record
    Type=Type

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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