I have to call method using REST service as I got some solution from material but getting error in await
public static Task RunAsync()
{
string pathValue = WebConfigurationManager.AppSettings["R2G2APIUrl"];
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(pathValue);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
var id = "12421";
HttpResponseMessage response = await client.GetAsync("api/products/1");
var jobid = new Jobs() { Job_ID = id};
response = await client.PostAsJsonAsync("api/products", jobid);
if (response.IsSuccessStatusCode)
{
Uri gizmoUrl = response.Headers.Location;
}
}
}
static void Main()
{
RunAsync().Wait();
}
await is not exist in current context as I am using vs2010 but is there any other solution for this?