Multiple API Call - 15+ Seconds Response Time

Highlighted
Shopify Partner
3 0 0

Hi, 

 

I need to get the order count for the last 30 days in a 1 day period. That´s what I wrote but the response time is 15 seconds and up. Is there any smarter strategy? I did not found a direct call to the orders api to receive the daily orders. Any one any ideas?

for ($i = 0; $i < 30; $i++)
{
    $timestamp = time();
    $tm = 86400 * $i; // 60 * 60 * 24 = 86400 = 1 day in seconds
    $tm = $timestamp - $tm;


    $the_date = date("Y-m-d", $tm);
    $newdate = date('Y-m-d', strtotime($the_date. ' + 1 days'));


    $orderinfo = shopify_call($token, $shop, "/admin/orders/count.json?status=any&created_at_min=".$the_date."&created_at_max=".$newdate, $array, 'GET');
    $orderinfo = json_decode($orderinfo['response'], JSON_PRETTY_PRINT);

    print_r($orderinfo);
    
}
0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hey @denni1220 ,

 

Have you looked into the Shopify Bulk Operations API? It's a relatively new Shopify API built on top of GraphQL Admin API that can be used to query and fetch large amounts of data asynchronously from Shopify. 

 

https://help.shopify.com/en/api/guides/bulk-operations

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like