alexdoan101 Posted April 5, 2011 Share Posted April 5, 2011 HI, does anyone know how to do filter for date ranges for the webservice orders api?You can do this for an exact timestamp api/orders?filter[invoice_date]=[2011-03-31 08:59:13]but i want to search on date range. How do i filter for a date range? Link to comment Share on other sites More sharing options...
mikih57 Posted April 6, 2011 Share Posted April 6, 2011 Hello, Do you know the link of webservice documentation ?Thanks !!Ps : Are you french ? Link to comment Share on other sites More sharing options...
PrestaMagic Posted December 18, 2011 Share Posted December 18, 2011 Hey Alex, Don't know if you still need this, but I have it for you. Here's how to filter between a range of dates: api/orders?filter[invoice_date]=[2011-03-3,2011-3-4]&date=1 You have to put that silly "date=1" in the params otherwise it no worky. A bug out there and this was the patch apparently. This applies for using CURL against the API as well. Hope this helps! 1 Link to comment Share on other sites More sharing options...
kusflo Posted March 23, 2017 Share Posted March 23, 2017 I create a library that modifies the original and allows filtering recent orders among other things. Regards! https://github.com/kusflo/PrestaShopWebService Link to comment Share on other sites More sharing options...
sadanandsk Posted April 27, 2017 Share Posted April 27, 2017 Hi, I need to integrate my prestashop with multiple warehouse management systems. Each product is however unique to a warehouse and can be defined by the supplier or warehouse fields. The warehouse system api however calls for all orders from prestashop, but I'd like to only send orders for products specific to that supplier or warehouse through the api call although the warehouse system is calling for all orders. Is it possible to achieve this in an easy way without a code change at the warehouse api end (since that is a 3rd party tool). Maybe by adding filters to the incoming api call and passing it on? Link to comment Share on other sites More sharing options...
Frank Begbie Posted July 27, 2023 Share Posted July 27, 2023 Wanted to restrict the selection of orders by Invoice_date but the following command has no effect, all orders come. With this selection, no orders should actually be displayed in my case. Will be read via webservice- orders/?filter[invoice_date]=[2023-07-25 10:56.45,2023-07-26 10:58.43]date=1 Seems like in Prestashop 8.0.4 filtering by a date range doesn't work anymore. Link to comment Share on other sites More sharing options...
Lakslilak Posted September 28, 2023 Share Posted September 28, 2023 On 7/27/2023 at 10:45 AM, Frank Begbie said: Wanted to restrict the selection of orders by Invoice_date but the following command has no effect, all orders come. With this selection, no orders should actually be displayed in my case. Will be read via webservice- orders/?filter[invoice_date]=[2023-07-25 10:56.45,2023-07-26 10:58.43]date=1 Seems like in Prestashop 8.0.4 filtering by a date range doesn't work anymore. Hello good sir, while i'm not on the same version (I am on 1.7.8.3) your problem might be a missing & between the filter and the date parameter. So your URL should look like this: orders/?filter[invoice_date]=[2023-07-25 10:56.45,2023-07-26 10:58.43]&date=1 Hope that helps. Link to comment Share on other sites More sharing options...
Zohaib-fk Posted September 30, 2023 Share Posted September 30, 2023 In PrestaShop's WebService API, you can filter data based on date ranges using the filter parameter in the URL when making a request to retrieve data. You will typically use the date or date_upd field to filter data based on the creation date or last update date. Here's how you can use the filter parameter to specify date ranges: Filtering by Creation Date (date_add) To retrieve data within a specific date range based on the creation date, you can use the filter[date_add] parameter. For example: CSS /api/products/?display=full&filter[date_add]=[2023-01-01,2023-12-31] This example will retrieve products created between January 1, 2023, and December 31, 2023. Filtering by Update Date (date_upd) To retrieve data within a specific date range based on the last update date, you can use the filter[date_upd] parameter. For example: CSS /api/products/?display=full&filter[date_upd]=[2023-01-01,2023-12-31] This example will retrieve products that were last updated between January 1, 2023, and December 31, 2023. Combining Filters You can also combine multiple filters to specify more complex date ranges or other criteria. For instance, you can filter products that were created within a specific date range and have a certain status: CSS /api/products/?display=full&filter[date_add]=[2023-01-01,2023-12-31]&filter[active]=1 This example retrieves active products created between January 1, 2023, and December 31, 2023. Remember to adapt the endpoint and resource (products in the examples) to your specific use case, as well as the date format to match the format used in your PrestaShop installation. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now