Ho una richiesta web che funziona correttamente, ma restituisce solo lo stato OK, ma ho bisogno che l'oggetto che chiedo venga restituito. Non sono sicuro di come ottenere il valore json che sto richiedendo. Sono nuovo nell'uso dell'oggetto HttpClient, c'è una proprietà che mi sto perdendo? Ho davvero bisogno dell'oggetto restituito. Grazie per qualsiasi aiuto
Effettuare la chiamata - funziona correttamente restituisce lo stato OK.
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept
.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var responseMsg = client.GetAsync(string.Format("http://localhost:5057/api/Photo")).Result;
Il metodo api get
//Cut out alot of code but you get the idea
public string Get()
{
return JsonConvert.SerializeObject(returnedPhoto);
}
