can someone share a working c# example that connects to clover and extract order list? i try the sample from website but i get 401 unautorised back.
can someone share a working c# example that connects to clover and extract order list? i try the sample from website but i get 401 unautorised back.
401 is generally tied to expired/invalid token. I would suggest checking your OAuth/acessToken.
C# HttpClient Ex:
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://sandbox.dev.clover.com/v3/merchants/{mId}/orders"); request.Headers.Add("Authorization", "Bearer {accessToken"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());
C# RestSharp Ex:
var options = new RestClientOptions("https://sandbox.dev.clover.com") { MaxTimeout = -1, }; var client = new RestClient(options); var request = new RestRequest("/v3/merchants/{mId}/orders", Method.Get); request.AddHeader("Authorization", "Bearer {accessToken"); RestResponse response = await client.ExecuteAsync(request); Console.WriteLine(response.Content);
3 People are following this question.