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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
henncarvalho
New Member

scheduled refresh error - Dynamic data source - Paginated API

Hello all!

I am having trouble trying to configure the scheduled refresh in Power BI because my data source is dynamic.

My query fetches ticket data from the Movidesk API. The API is paginated, and I use the List.Generate() to paginate through the $top and $skip functions from the API. I believe this is what makes the API url dynamic.

Can anyone help me on how to fix it so that I can use the scheduled refresh?

Thanks

 

let
// Base URL for the API call
BaseUrl = "https://api.movidesk.com",

// Function to fetch data using Web.Contents  
FetchData = (baseUrl as text, skip as number) as nullable list =>
let
// Construct the relative path and query string
RelativePath = "/public/v1/tickets/past",
QueryString = [
token="secret-token",
#"$select"="id,isDeleted,createdDate,type,category,urgency,status,baseStatus,origin,owner,ownerteam,createdBy,tags,resolvedIn,reopenedIn,closedIn,lifetimeWorkingTime,stoppedTimeWorkingTime,lastUpdate,serviceFull,serviceFirstLevel,serviceSecondLevel,serviceThirdLevel,protocol,slaAgreement,slaAgreementRule,slaSolutionTime,slaResponseTime,slaSolutionChangedByUser,slaSolutionChangedBy,slaSolutionDate,slaSolutionDateIsPaused,slaResponseDate,slaRealResponseDate,type,originEmailAccount,createdBy,contactForm,actionCount,resolvedInFirstCall",
#"$orderby"="createdDate asc",
#"$expand"="owner,clients($select=id,businessName,email,personType,profileType),childrenTickets($select=id,isDeleted),parentTickets($select=id,isDeleted),assets($select=name,label,categoryFull,categoryFirstLevel,categorySecondLevel,categoryThirdLevel)",
#"$filter"="createdDate gt 2016-10-01",
#"$top"="100",
#"$skip"=Number.ToText(skip)
],
Source = Web.Contents(baseUrl, [RelativePath=RelativePath, Query=QueryString]),
Data = try Json.Document(Source) otherwise null
in
Data,

// Generate a list of data using List.Generate
Consulta2 = List.Generate(
() => [result= FetchData(BaseUrl, 0), skip = 0],
each [result] <> null and List.Count([result]) > 0,
each [result= FetchData(BaseUrl, [skip] + 100), skip =[skip] + 100],
each [result]
),

// rest of the data modelling

 

2 REPLIES 2
lbendlin
Super User
Super User

That's an ODATA endpoint.  Use the ODATA connector.

Their documentation states that their API has some ODATA features implemented, but it is not an ODATA endpoint. So the ODATA connector does not work. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.