X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   REST API Module (https://forum.x-cart.com/showthread.php?t=77835)

atclarkson 06-01-2020 08:21 AM

REST API Module
 
Trying to get all orders from 2020.

I have tried following the documentation and pass a condition with a start date and end date as an array. I have tried both Unix time and W3C time formats and all I can get is it returning all lifetime orders.

I have tried with W3Ctime:
https://agritronixcorp.com/admin.php?target=RESTAPI&_key=<rest-api-key>&_path=order&_cnd[dateRange]=[2020-01-01T00:00:01-04:00,2020-06-01T11:46:56-04:00]

I have tried with Unix Time:
https://agritronixcorp.com/admin.php?target=RESTAPI&_key=<rest-api-key>&_path=order&_cnd[dateRange]=[1577836801,1590693834]

I will point out that I have replaced my actual API key with a placeholder in the examples above.

Does anyone have any advice?

memoto 06-01-2020 08:50 AM

Re: REST API Module
 
You should use not the Timestamp format but the format from your Orders section. Simply copy past it into your API request.

atclarkson 06-01-2020 09:03 AM

Re: REST API Module
 
SOLVED:

For anyone else having this problem. despite the documentation saying it wants an array [start,end] It doesn't.

As Memoto said above you should go to your orders page and copy the date from there.

To clarify go to the orders page and use the filter option to select the dates you want. then copy the result from the text box. for me it is like this:

01-Jan-2020 ~ 01-Jun-2020

then paste that in your api call

https://agritronixcorp.com/admin.php?target=RESTAPI&_key=<rest-api-key>&_path=order&_cnd[dateRange]=01-Jan-2020 ~ 01-Jun-2020

That should do it.


All times are GMT -8. The time now is 02:56 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.