GET Woocommerce Request with Criterion by Date - restSharp

Asked

Viewed 171 times

1

People I’m doing an integration with C# and the Woocommerce API, my situation is the following, I can communicate with the API through restSharp and I can fetch the site requests through the access URL, 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 resolve this? Or how can I insert this parameter into my request?

Adding more information: The documentation for Woocommerce I follow is this on the link: http://woocommerce.github.io/woocommerce-rest-api-docs/? php#Authentication-over-http

And below follows code q I am using and this returning me error 401:

  var client = new RestClient(URLAPI/orders?after=2018-05-13T16:28:02");
            var request = new RestRequest(Method.GET);
            request.BuildOAuth1QueryString(client, "CK", "CS");
            var response = client.Execute(request);
  • In that case, you’d have to see the API documentation. If you have access to the documentation and want to post the section that talks about how to authenticate, we can help you pass the parameters. It is not necessary to inform your authentication data here.

  • Marcelo the documentation that I follow this link: link "var client = new Restclient("http://meusite.com/wp-json/wc/v2/orders?after=2018-05-13T16:28:02"); var request = new Restrequest(Method.GET); request.Buildoauth1querystring(client, "ck_527f2f46c5e8ef9adeaad1", "cs_20eac7b891e31e042fbe2"); var Response = client. Execute(request);"

1 answer

0


Guys figured out how to fix my situation, in my code missed insert line Addqueryparameter, conforming to below:

var client = new RestClient("URL/orders");
            var request = new RestRequest(Method.GET);
            request.AddQueryParameter("after", "2018-05-13T16:28:02");
            request.BuildOAuth1QueryString(client, "CK", "CS");
            var response = client.Execute(request);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.