user yasir

user yasir

  • 2.1k
  • 5
  • 223

I want to get some data from web with access token.

Sep 24 2018 4:04 AM
This code is not working for me,
 
public async Task callapi()
{
try
{
RestClient client = new RestClient("https://mytest.syncloft.com/");
client.ClearHandlers();
RestRequest request = new RestRequest("shop/sync-discounts", Method.GET);
request.RequestFormat = DataFormat.Json;
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer" + accessToken);
var response = await client.ExecuteTaskAsync(request);
if (response != null)
{ Console.Write(response); }
else { Console.Write("Error0"); }
} catch(Exception exc)
{ Console.Write(exc.ToString()); }
}

Answers (1)