If anyone still struggling with it. Here is the URL for the request to get order from two dates. The issue is the url encode for filter parameter.
Below is an working exanple of the PHP cURL to get orders of today date.
// PrestaShop API endpoint (replace with your store's domain)
$prestashop_url = 'https://YOURSHOPURLHERE.com/api/';
// Your PrestaShop API key
$api_key = 'Your API Key';
// Get today's date in the format PrestaShop uses
$today = date('Y-m-d'); // As of today the date will be like '2025-01-06'
// Prepare the URL for fetching orders created today
$order_url = $prestashop_url . 'orders?filter[date_add]=[' . urlencode($today . ' 00:00:00') . ',' . urlencode($today . ' 23:59:59') . ']&date=1&output_format=JSON';
// cURL setup for fetching order IDs
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $order_url); // URL to the orders endpoint
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Basic ' . base64_encode($api_key . ':')
));
// Execute the cURL request
$response = curl_exec($ch);
// Check for errors
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
exit;
}
// Close the cURL session
curl_close($ch);