I am calling www.boardgamegeek.com API.
I am using below code:
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://www.boardgamegeek.com/xmlapi/collection/dhasmain");
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/xml"));
// List data response.
HttpResponseMessage response = client.GetAsync("?own=1").Result;
if (response.IsSuccessStatusCode)
{
var dataObjects = response.Content.ReadAsStringAsync().Result;
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
But it is showing Result=Not yet computed.
Can anyone please suggest to me what the issue is?
I am also using the below code but it is not returning anything.
string dataObjects = ""; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://www.boardgamegeek.com/xmlapi/collection/zefquaavius"); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/xml"));
client.GetStringAsync("?own=1").ContinueWith(task =>
{
dataObjects = task.Result;
});