Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I've built out my Shopify API and can connect to it in Power BI and Postman. Via Postman I can see the next URL in the response header which I undersand is what's needed for pagination.
I've worked with pagination in Power BI using ListGenerate but that was mainly where we knew the number of pages to be called.
How can I do this in Power BI when the next URL is included as part of the Response Header from the first call?
I almost need it to read
First call - next url 1
next url 1 - return url 2
reutnr url 2 - reutrn url 3 etc.
Has anyone successfully done this?
Solved! Go to Solution.
Hi @DrewSmith ,
To achieve this in Power BI, you could use the Power Query M language to programmatically follow the pagination links.
Please try below steps:
1. Initial API Call: Start by making an initial API call to fetch the first set of data along with the pagination link from the response headers.
2. Parse Response Headers: Extract the "next URL" from the response headers. This will require parsing the headers to locate the URL for the next page of data.
3. Recursive Function: Create a recursive function in Power Query M that takes the "next URL" as an input, fetches the data, and then calls itself with the new "next URL" found in the response headers of the subsequent call. This function should continue to execute until there is no "next URL" found, indicating the end of the data.
Here's a simplified example of how you might start to structure this function in Power Query M:
et
FetchData = (url as text) as table =>
let
Source = Json.Document(Web.Contents(url)),
Data = Source[data],
NextUrl = Source[headers][next_url], // Adjust this based on actual header structure
Output = if NextUrl <> null then Table.Combine({Data, @FetchData(NextUrl)}) else Data
in
Output
in
FetchData("YourInitialShopifyApiUrl")
Note: This is a simplified example. You'll need to adjust the logic to match the specific structure of the Shopify API response and ensure you handle authentication headers if required.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you struggle with connecting to Shopify API, there are ready-made solutions for extracting data automatically from Shopify. Here is one of them: https://vidi-corp.com/shopify-power-bi-connector/
Hi @DrewSmith ,
To achieve this in Power BI, you could use the Power Query M language to programmatically follow the pagination links.
Please try below steps:
1. Initial API Call: Start by making an initial API call to fetch the first set of data along with the pagination link from the response headers.
2. Parse Response Headers: Extract the "next URL" from the response headers. This will require parsing the headers to locate the URL for the next page of data.
3. Recursive Function: Create a recursive function in Power Query M that takes the "next URL" as an input, fetches the data, and then calls itself with the new "next URL" found in the response headers of the subsequent call. This function should continue to execute until there is no "next URL" found, indicating the end of the data.
Here's a simplified example of how you might start to structure this function in Power Query M:
et
FetchData = (url as text) as table =>
let
Source = Json.Document(Web.Contents(url)),
Data = Source[data],
NextUrl = Source[headers][next_url], // Adjust this based on actual header structure
Output = if NextUrl <> null then Table.Combine({Data, @FetchData(NextUrl)}) else Data
in
Output
in
FetchData("YourInitialShopifyApiUrl")
Note: This is a simplified example. You'll need to adjust the logic to match the specific structure of the Shopify API response and ensure you handle authentication headers if required.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
65 | |
64 | |
56 | |
39 | |
27 |
User | Count |
---|---|
85 | |
59 | |
45 | |
43 | |
38 |