Rest API Filter Orders/Product only once even if we hit multiple times

sairams
New Member
2 0 0

As i said in subject. I have a filter query in rest API. But that filters query returns all the new and old orders. Means the same order is being repeated everytime with new orders/Product included to it. So i want to know is there any tag or column specifying that this particular order has been imported or not. If anything similar to it please let me know.  Or put me in different view way like can we avoid orders/product which has been pulled already. 

Replies 3 (3)
gseilei
Shopify Expert
235 28 41

I am not sure I understand completely what you mean, but it is possible to get orders from the API that have been done after an specific order ID. That might be helpful for you... i.e.:

 

Retrieve all orders after the specified ID

GET /admin/api/2020-01/orders.json?since_id=123
We help you achieve your Goals! Visit us on: Webmefy.com
sairams
New Member
2 0 0

Ok consider this filter criteria "updated_at_min=10&status=open". I made it problematically this filter criteria to use every time. So i run first at 10 a.m let say i get 100 records. Next time i run after a 15 min gap i.e 10.15 a.m. I get 150 records. Which is 100 records i already pulled earlier and only 50 new records has came. So my question is how to avoid those 100 records on second try or avoid pulling same records in subsequent request. Hope now it is clear . If not plz let me know. Thanks in advance.

gseilei
Shopify Expert
235 28 41

you can avoid the old records by saving the ID from the last order retrieved and using the filter since_id. By doing that you will just get all orders that have been generated after the ID that match with the other criteria of your search.

 

Also consider adding a limit (max 250) to your request, to avoid missing any records.

We help you achieve your Goals! Visit us on: Webmefy.com