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
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...
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;
}
Hello, following the instructions I successfully solved the problem.
Thank you very much!
All the best,
Samantha, professional carpet cleaners Mayfair
[...] ->addAttributeToFilter('created_at', [ 'from' => [$fromDate], 'to' => [$toDate], ]) [...]
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 ?