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

 

3 REPLIES 3

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