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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Wayne74
Helper I
Helper I

PowerQuery API Pagination Help

Hi All,

 

I am really stuck here at the moment and just need a pointer or hint or something to know where to look.  I am calling an API from Canvas to get accounts, courses and enrollments.  Accounts and courses is fine as I can loop through use the page=x parameter.  However Enrollments changes that.  The link to the next page is in the header under something called Link and uses something called a bookmark.  I can not for the life of me work out how to make this work as I cant seem to see the 'link' anywhere in Power Query.

 

So this is a link to the API documentation.  The one I am looking at is List Enrollments

Canvas LMS REST API Documentation (instructure.com)

 

If I call this in Postman I can see this (I have cut out most of the data for obvious reasons)

Wayne74_0-1674183080583.png

 

So I got this to try to see the header data

 

 

 

= (CourseID as text) =>

let
    Source = Value.Metadata(Web.Contents(pURL&"/api/v1/courses/"&CourseID&"/enrollments?access_token="&pAccessToken))
in
    Source

 

 

 

Which gives me this

Wayne74_3-1674183239785.png

 

and then if I expand the Headers record I get this.  Nothing in here that shows the bokmark or the Link field

Wayne74_2-1674183208874.png

 

Any help would be greatly appreciated please.

3 REPLIES 3
lbendlin
Super User
Super User

You asked for Value.MetaData - that will not give you the payload of the request which has the data and pagination information.

 

Note that your approach will not work for scheduled refresh.  Read about RelativePath.

I have looked into Relative path and I am fixing that thank you.  Still haven't worked out how to get the header yet though with the link to the next bookmark.

Use Web.Contents directly.  That should give you the header data and the payload.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.