I'm trying to consume a REST api with bearer token authentication. I'm getting this error:
Media type is unsupported
Code:
using System;using RestSharp;using System.Configuration;using Newtonsoft.Json.Linq; string Authtoken = "My OAuth token"; var client = new RestClient(DataserviceURL); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer " + Authtoken); try { IRestResponse response = client.Execute(request); var obj = JObject.Parse(response.Content); Console.WriteLine("Data_" + response.Content); Console.ReadLine(); } catch (Exception ex) { string ex1 = ex.ToString(); }