Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
141 | |
75 | |
64 | |
52 | |
47 |
User | Count |
---|---|
219 | |
89 | |
73 | |
66 | |
60 |