cancel
Showing results for 
Search instead for 
Did you mean: 

Get order between 2 date

Get order between 2 date

Hello,

 

I want to get all orders between 2 date and I have this error :
"{"message":"The signature is invalid. Verify and try again."}"

my url is this one : 

/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=created_at&searchCriteria[filter_groups][0][filters][0][condition_type]=from&searchCriteria[filter_groups][0][filters][0][value]=2021-06-22 00:00:00&searchCriteria[filter_groups][1][filters][0][field]=created_at&searchCriteria[filter_groups][1][filters][0][condition_type]=to&searchCriteria[filter_groups][1][filters][0][value]=2021-07-05 23:59:59

 

if I try just that : /rest/V1/orders?searchCriteria it's work but I have all the orders with this command

 

Have you a solution to my problem ?

Thanks

 

8 REPLIES 8

Re: Get order between 2 date

Hi,

 

use the below way to get orders between two dates and keep in mind mention the time with dates.

 

 

http://localhost/test/rest/V1/products?
searchCriteria[filter_groups][0][filters][0][field]=created_at&
searchCriteria[filter_groups][0][filters][0][condition_type]=from&
searchCriteria[filter_groups][0][filters][0][value]=2019-07-22 00:00:00&
searchCriteria[filter_groups][1][filters][0][field]=created_at&
searchCriteria[filter_groups][1][filters][0][condition_type]=to&
searchCriteria[filter_groups][1][filters][0][value]=2019-07-23 23:59:59

reference link -  https://magento.stackexchange.com/questions/282973/get-product-data-between-2-dates-using-filters-in...

 

Re: Get order between 2 date

Hi,

 

I try and I have the same error : "{"message":"The signature is invalid. Verify and try again."}" 

 

Maybe it's not the url the problem this is my code in c# :

 

magento.getOrders();

 

the code for magento :

public Magento(string magentoUrl, string clientID, string clientSecret, string tokenID, string tokenSecret)
{
Client = new RestClient(magentoUrl)
{
Encoding = Encoding.UTF8,
Authenticator = OAuth1Authenticator.ForProtectedResource(clientID, clientSecret, tokenID, tokenSecret)
};
}

 

the code for getOrders

public Orders getOrders()
{

String url = String.Format("/rest/fr/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=created_at&searchCriteria[filter_groups][0][filters][0][condition_type]=from&searchCriteria[filter_groups][0][filters][0][value]=2019-07-22 00:00:00&searchCriteria[filter_groups][1][filters][0][field]=created_at&searchCriteria[filter_groups][1][filters][0][condition_type]=to&searchCriteria[filter_groups][1][filters][0][value]=2021-07-23 23:59:59");
var request = CreateRequest("/rest/fr/V1/orders?searchCriteria", Method.GET);


var response = Client.Execute(request);

if (response.StatusCode == System.Net.HttpStatusCode.OK)
{

return JsonConvert.DeserializeObject<Orders>(response.Content);

}
return null;

}

 

and the code for CreateRequest :

private RestRequest CreateRequest(string endPoint, Method method)
{
var request = new RestRequest(endPoint, method);
request.RequestFormat = DataFormat.Json;
request.AddHeader("Accept", "application/json");
return request;
}

Re: Get order between 2 date

I have also same error if have any solution pls help.

 

sky light pay card

Re: Get order between 2 date

Hi,

Did you solve it?

miocado login 



 

Re: Get order between 2 date

no, i too couldn't find it.

blank world map 

Re: Get order between 2 date

Hello, following the instructions I successfully solved the problem.

Thank you very much!

 

All the best,

Samantha, professional carpet cleaners Mayfair

 

Re: Get order between 2 date

[...]
    ->addAttributeToFilter('created_at', [
        'from' => [$fromDate],
        'to' => [$toDate],
    ])
[...]

Re: Get order between 2 date

Hello,

With swagger it's working, it give mi this URL : /rest/fr/V1/orders?searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=created_at&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=2019-07-22&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5BconditionType%5D=from

 

but on c# I have this error with this URL : {"message":"The signature is invalid. Verify and try again."}

 

Do you have an idea ?