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

Don'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.

Reply
alan19
Frequent Visitor

Shopify API

I am trying to bring shopify  orders into Power BI desktop but seems I can not import more than 250 orders, this query brings 250 orders and fails at 251. anyone has any idea?

Thank you.

 

let
    key = "API",
    delay = #duration(0, 0, 2, 0), 
    GetOrdersWithSinceId = (since_id as nullable text) as record =>
        let
            queryParameters = if since_id = null then
                [
                    status = "any",
                    limit = "250",
                    order = "created_at asc"
                ]
            else
                [
                    status = "any",
                    limit = "250",
                    order = "created_at asc",
                    since_id = since_id
                ],
            response = Json.Document(
                Web.Contents(
                    url,
                    [
                        Headers = [#"X-Shopify-Access-Token" = key],
                        Query = queryParameters
                    ]
                )
            )
        in
            response,
    GetMaxId = (orders as list) as nullable text =>
        try
            Text.From(List.Max(List.Transform(orders, each _[id])))
        otherwise
            null,
    GetAllOrders = List.Generate(
        () => [since_id = null, result = GetOrdersWithSinceId(null), orders = GetOrdersWithSinceId(null)[orders]],  
        each List.Count([orders]) > 0,  // condition to continue
        each [
            since_id = GetMaxId([orders]), 
            result = Function.InvokeAfter(() => GetOrdersWithSinceId(since_id), delay),
            orders = result[orders]
        ],  
        each [orders]  
    ),
    ExtractOrders = List.Combine(List.Transform(GetAllOrders, each _)),
    OrdersTable = Table.FromList(ExtractOrders, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(OrdersTable, "Column1", {"id", "created_at", "total_price", "customer", "line_items"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1", {
        {"created_at", type datetimezone}
    }),
    #"Sorted Rows" = Table.Sort(#"Changed Type",{{"created_at", Order.Ascending}})
in
    #"Sorted Rows"
 
4 REPLIES 4
ReportGuru
Post Patron
Post Patron

Hi @alan19 were you able to find a solution? As other comment mentioned, having a custom connector for Shopify is hard as it requires some technical knowledge. As a workaround, maybe you can try to test your connection with a 3rd party connector. I've tried windsor.ai, supemetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Shopify connector in the data sources list:

 

SHOPIFY-1.jpg

 

After that, you need to follow instructions and install the windsor.ai app from the Shopify App Store:

 

SHOPIFY-1.5.png

 

then on preview and destination page you will see a preview of your Shopify fields

 

SHOPIFY-2.jpg

 

There just select the fields you need. Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url.

 

SELECT_DESTINATION_NEW.png

EugeneLebedev
Helper IV
Helper IV

Shopify API is too difficult to create a custom Power BI connector in my opinion. I would recommend instead to extract data into an Azure SQL Server database. This way you work around most of the Shopify API limitations. Here is a ready-made solution for that: https://vidi-corp.com/shopify-power-bi-connector/

WanderingBI
Resolver III
Resolver III

The Shopify API seems to limit input arrays to 250 entries:

 

Shopify API rate limits 

"Input arguments that accept an array have a maximum size of 250. Queries and mutations return an error if an input array exceeds 250 items."

this is right but any idea how to deal with it?

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.