Discussing APIs and development related to customers, discounts, and order management.
Hi i have an issue regarding orders api, it seems i cannot get the data from what i expected in the date range added in the parameters, actual data posted in our dashboard vs orders api data is lesser, below is my sample code that ive added and a parameter filter so that i can get the data that we need.
What is the actual difference you are seeing? You do know that by default an API call will only give you 50 records right? So if you set a date of April 18th, 2019 as your minimum date, and you only see 50 orders from around then, that is your answer.
When you ask for resources using the RestAPI you can ask for up to 250 orders and page through them a page at a time till you get all of them. With the GraphQL API you page using cursors, much like any SQL database calls.
Note that orders are so complex these days, when you ask for 250 and you page a lot, Shopify can gum up and choke and cause timeouts. Your experiments will let you know if that happens to you. You can try paging 100 records at a time perhaps.
Im doing a comparison between the orders api vs the data exported in shopify
$count = $instance->getApi()->countOrders(['status' => 'any', 'created_at_min' => '2019-04-17']);
total is = 5230
vs
exported csv = 7287
can you explain how am i getting this data that does not match?
Thanks
You might want to then do a diff on the files. In other words, reveal the rows that make up the data off the 7287 minus the 5230. With that you will expose the data not seen in your API calls, and you can start to figure out why perhaps? Without more to go on, a simple metric like yours is not worth much. As a quick example of why I say that, you will note that there are/were reports from Shopify that for example return cancelled orders. So a merchant would see a count of 20 orders for example. However, closer inspection would reveal 4 of those were cancelled. So if you blindly added up all the numbers in the report, you'd for sure be off. It is that kind of inspection that I speak of.
I know you're using the "any" filter, but still. 2057 lines will jump out at you in the diff, and you'll likely see right away what is going on.
Hi i just figured out this issue, but do you happen to have any idea on my other post?