picqer get orders from specific date - api

I want to know if there is a way to look back at orders from a few days ago with the picqer API.
Looking at the filters and stuff on their website it doesn't look like you can with only the API. Is there a way to do it anyway?
(i am working with vue.js and axios for my requests idk if this is relevant)

Casper from Picqer here. At this moment we do not have a filter for orders until a specific date. But if you are only looking for orders from the last few days, you could cycle trough the orders (100 items per request) until the date you want to get the orders from.
We have a suggestion noted for filtering orders in the API for a specific date. Did you notify our support team about this? Then we will notify you when that filter is available.
These are the filters we have active for the orders endpoint at this moment: https://picqer.com/en/api/orders#filters

Related

Can retrieve some orders, but not all. using Shopify REST API

Trying to determine why I am not able to retrieve all orders under my test store (so that I can understand what is happening in Production as well)
As you can see above, I have 13 orders placed on my test store, but I can only retrieve 11. The two orders placed in august, that I have marked in red, are not reachable. Even when I try to look them up by searching by their ID's
Requests I am using:
sharing my access token here, its fine. this is just a test store.
X-Shopify-Access-Token: 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
https://vitor-dawn-dev-store.myshopify.com/admin/api/2021-10/orders.json?status=any - gives me the 11 orders
https://vitor-dawn-dev-store.myshopify.com/admin/api/2021-10/orders/count.json?status=any - returns 13 (The number I expected).
https://vitor-dawn-dev-store.myshopify.com/admin/api/2021-10/orders/4062335991963.json - one of the missing order's ID. gives me a 404 Not found.
Some sample IDS:
Valid and reachable order ID sample: 4270842052763
Order ID's that aren't reachable: 4062335991963 and 4062362665115
Also tried through graphQL, but got the same results.
Does anyone know why this is happening?
From the Shopify REST API docs for Orders
Only the last 60 days' worth of orders from a store are accessible
from the Order resource by default. If you want to access older
orders, then you need to request access to all orders. If your app is
granted access, then you can add the read_all_orders scope to your app
along with read_orders or write_orders. Private apps are not affected
by this change and are automatically granted the scope.
Your app needs read_all_orders scope to be able to fetch data for orders created more that 60 days ago.

Shopify API get Total Returns/Refunds

I am trying to get the Net Sales of orders of our Shopify store on daily basis. I can do it with the Orders API, but there seems to be a mismatch for the refunds returned by the API and the refunds/returns that show up in the dashboard.
In fact, the API doesnt show any refunds for the orders at all but there does seem to be some amount deducted from the Total Sales of Orders which make the actual Net Sales for that particular day.
I can retrieve the orders for one day by this example URL. I iterate through all the orders and add up each Order's amount which gives an exact number of Total Sales which match up to the number in the dashboard. But this Total Sales value doesnt take into account the refunds/returns.
/admin/api/2021-07/orders.json?status=any&created_at_min=2021-08-17T00:00:00-04:00&created_at_max=2021-08-18T00:00:00-04:00&limit=250
There is a refunds in the returned json for each order as well in the above call but that is empty for all the objects.
I have explicitly tried to retrieve the refunds as well by following API call but it also returns empty for all the orders.
/admin/api/2021-07/orders/{order_id}/refunds.json
You may have a look at the Dashboard Sales image for one day. Please note in this image, I can get the exact value for Total Orders from the API but can not retrieve a single refund/return for any of the order.
Would you be having an idea what are these Refunds/Returns shown in the Dashboard? If so, is there a way how can I accurately calculate the Refunds/Returns by the API as well, so I can accurately calculate the Total Sales for one day?
You should be working with Transactions. Specifically, the refund transactions. An Order has many transactions. So given some order, you can get at the interesting transactions, and calculate your important values, like Net. I have aced this for many clients, as Shopify does not report this type of value very well. So I generate reports with Net, refunds, taxes, etc, providing much clearer guidance than the standard Shopify reports.

Get the latest events of a specific type from a specific device

Is there a way to get the latest event of a specific type from a specific device? So far I queried all events via myURL/event/events?source=<<ID>>&type=<<type>>.
Or is there a way to get a collection of events ordered by their creationTime? This could solve my problem too
In the documentation I only found parameters like dateFrom and dateTo. But what if I don't know the time range of the last event?
The syntax is: /event/events?type={type}&source={source}.
For more information on the available endpoints:
GET /platform
Answer from the support-team:
currently there is no way to revert the order of events. Besides
dateFrom and dateTo you can also use creationFrom and creationTo. This
will take the creationTime (server side timestamp when event was
created) instead of the time (that is send within the event) But the
order will still be oldest -> newest.
Best approach currently would be to use a good estimated time range
(so you don't end up with 0 events in the response) where the
dateTo/creationTo is in the future. If you add to the query params
withTotalPages=true the result will give you the total pages in the
statistics part.
Knowing the total pages you can you can do the query again but with
currentPage=XX instead of withTotalPages=true and take the last
element.
We have this functionality on measurements and audits where you can
add the parameter revert=true. I will add an improvement that we
extend this to the other APIs but at the moment you are limited to the
workaround.
You can just only set the dateFrom parameter and the pageSize to 1 like so: &pageSize=1&dateFrom=1970-01-01. As of September 2017, this returns the most recent event.

How to get /admin/products.json in a chronological order?

I need to be able to poll more than 250 products from the Shopify API. In order to do so, I need to retrieve the products from the API in a chronological order, with the oldest products first. Once I have the first 250 items, I retrieve another 250 items filtered by max_created_at.
I noticed that: GET /admin/products.json returns the products in a random order, but GET /admin/products.json?since_id=0 returns the products in a chronological order. Is this the intended behaviour? Or is there a flag that I can send with GET /admin/products.json to specify the sorting order?
Edit: I guess my question boils down to this: Is there a field that I can set that the results returned by the Shopify API will be ordered by?
Maybe the API has been updated since the last post but now you can do that like that :
https://yourshop.myshopift.com/admin/products.json?limit=50&fields=id,images,title&order=created_at+desc
Just add the query string parameter order=created_at+asc
This is an undocumented feature but it seems to work for most fields.
This is unintended behaviour, reliable sort orders for Product are limited to title and total, and then filtering options are as listed in the API docs.

ebay getOrders API

I am building a .net service to getOrders from ebay. my service runs fine, however I dont know how should I handle data.
For example I am using CreateTimeTo and CreateTimeFrom Filter to return orders from past 24 hours. I save them into my database, now some orders return no Address info.
My question is, Whats the best way to hadnle/update already imported orders into my database. Say for example order imported into my system wa without shiping info, and customer completed shipping info after a week, how would I update that order in my system?
Thanks
I would definitely use modtimefrom modtimeto filter. Ih this way you can get all order that have been modiefied in last "x interval". This way you will get either new orders and modified (checkout complete - paid - shipped) and so on. My favourite filter anyway is NumberOfDays. This one acts as ModTimeFrom/ModTimeTo but is way more simple and you don't have to deal with dates.
An order without address means buyer has not completed checkout (no payment selected so no shipping address as well yet).
Once buyer completes checkout or order is mark as paid the entire address will be avaible.
You can get buyer default address shipping by using call GetSellerTransaction
I hope i understood your question and to be helpful.