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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Is it possible to automatically use the nextPageUrl from an API call as the new web source?

I have got an API Call, which gives me 500 Results and a field under Page Details (nextPageUrl) with the rest of the data.

Is it possible to add this new link for as many times as there are additional Pages?

1 ACCEPTED SOLUTION
2 REPLIES 2
amithg
New Member

Hi.  I have tried to to follow the steps in SQL Code Space: Power BI/Power Query: API Response Pagination Part 2 - Paginate by Page Cursor to get data into my sheet (400k records, 30 per loop) but I keep getting no records.  Any help would be appreciated:

 

let    
    ufnGetList = (cursor) =>
        let 
            result = Json.Document(Web.Contents("https://apiendpoint" & "?cursor=" &cursor, [Headers=[Authorization="xxx"]])),
            nextCursor = try result[data][cursor] otherwise null,
            results = try result[data][results] otherwise null,
            record = [results = results, nextCursor = nextCursor]
        in 
            record,

    resultSet = List.Generate(
                    () => ufnGetList(""),
                    each _[nextCursor] <> null,
                    each ufnGetList(_[nextCursor]),
                    each [nextCursor = _[nextcursor], results = _[results]]
                    )
    in
        resultSet
 
the JSON of each result looks like:
 
{
    "status"200,
    "data": {
        "cursor""FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFHAxVE51WGdCeFVhMWFiZ2ltb3dUAAAAABtWSaEWOHRuNHZFVXNUazIyMC1QckhwUlFOUQ==",
        "limit"50,
        "results": [
             ...
            ],
 
Any idea what I am doing wrong?  The authorization and api data retrieve works fine for the first page but I can only retrieve 30 records, not all 400k.  Thanks!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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