Skip to main content
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.

Frequent Visitor

Power Query API error


Im rather new to PowerBi and would appreciate some help with an error I've been getting. 


I am calling the web API to bring in Product info from Repsly and this is the code that I am using: 


Final = List.Generate
Result= Json.Document(Web.Contents("", [Headers=[Accept="application/json"]])),
TotalCount = 1

each [TotalCount]>0,

Result= Json.Document(Web.Contents("" & Text.From([Result][MetaCollectionResult][LastID]), [Headers=[Accept="application/json"]])) ,
TotalCount = [Result][MetaCollectionResult][TotalCount]


each [Result][Products]
FinalTable = Table.FromRecords(List.Combine(Final))


The API is limited to 50 rows so this loops the API and brings in all the required information. I have investigated and the API has an issue that creates an additional blank row or a "null" value row at the end of the product list. 

This means that I am getting in all the product rows but it creates an error in the bottom row right below the final value. 

I have tried to remove the error by using standard options like "remove error/row etc" and replace values but it does not work. 


Screenshot of the Error below: 





I assume I have to eliminate the error in my call to the API. 

Can anyone assist with how I need to incorporate this into my code?  


Super User
Super User


change line 23 to filter out the null values. You may also want to review your code. Aren't you supposed to use NextID rather than LastID ?

Thanks, how would you add the filter? 

The API documentation confirms LastID and this code works perfectly for all the other endpoints. 

Helpful resources

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


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.

Top Solution Authors
Top Kudoed Authors