GET Request WooCommerce with criteria by Date - restSharp

1

I am doing an integration with C # and the WooCommerce API, my situation is this, I can communicate with the API through restSharp and I can get the requests of the site through the URL: link , so far so good! But when I try to enter a criteria for the search (like the creation date for example), the API returns me error 401 - No authorization.

Would anyone have an idea how to solve this? Or how can I insert this parameter into my request?

Adding more information: The documentation for Woocommerce that I follow is this at the link: link

And below is the code I'm using and this is returning me error 401:

  var client = new RestClient("http://safinunda.inunda.com.br/wp-json/wc/v2/orders?after=2018-05-13T16:28:02");
            var request = new RestRequest(Method.GET);
            request.BuildOAuth1QueryString(client, "ck_527f2f46c5e8ef9adeaad13758fcf4eea", "cs_ea20c7b891e31e042fbe2df1abbdc343a");
            var response = client.Execute(request);
    
asked by anonymous 18.05.2018 / 20:08

1 answer

0

I found out how to resolve my situation, my code was missing the line AddQueryParameter , as below:

var client = new RestClient("http://safinunda.inunda.com.br/wp-json/wc/v2/orders");
            var request = new RestRequest(Method.GET);
            request.AddQueryParameter("after", "2018-05-13T16:28:02");
            request.BuildOAuth1QueryString(client, "ck_527f2f46c5e8ef9adeaad13758fcf", "cs_ea20c7b891e31e042fbe2df1abbdc");
            var response = client.Execute(request);
    
18.05.2018 / 22:02