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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
kasife
Helper V
Helper V

Call APi

Hello guys,

I'm trying to call an API, and I'm using the page parameter to make the call. It turns out that this API seems to me to have no pages. How could I adjust the call of this function to be able to page and bring all the lines?

 

 

Function:
(
    page 
)
=>
let
    Fonte = 
        Json.Document(
            Web.Contents(
                "https://company.company.com.br", 
                [
                    RelativePath = "/api/cvio/empreendimento/",
                    Query = 
                    [
                        pagina = Number.ToText(page)

                    ],       
                    Headers = 
                    [
                        accept = "application/json",
                        email = _email,
                        token = _token
                    ]
                ]
            )
        )
in
    Fonte



function call
let
    totalpages = fx_empreendimento(1),
    listOfPages = List.Generate(
        () => [page = 1, data = fx_empreendimento(1)],
        each [page] <= totalpages,
        each [page = [page] + 1, data = fx_empreendimento([page]+1)]
    )
in
    listOfPages

 

 

The error that is returned:
Expression.Error: We were unable to apply field access to the List type.
Details:
Value=[List]
Key=total_pages

kasife_0-1690089596266.png

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @kasife ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Best Regards

Anonymous
Not applicable

Hi @kasife ,

You can refer the following links to connect API in Power BI Desktop using Web connector:

Power BI Using List.Generate to Reduce API Calls with Pagination - Strategy, solutions & Power BI fo...

How to Use List Generate to Make API calls in Power Query - YouTube

Solved: Using list.generate() to query an endpoint multipl... - Microsoft Fabric Community

And this error may occur when you are trying to access a list element by using a field name instead of an index.  The following links are the ones which have the similar problem as yours, hope they can help you solve your problem.

Solved: Re: Help with List.Generate() in making API calls - Microsoft Fabric Community

vyiruanmsft_0-1690267524707.png

Solved: Expression.Error: We cannot apply field access to ... - Microsoft Fabric Community

Best Regards

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.