I am trying to consume my api from another api, so I am using an HttpClient. My code Looks as follows:
public async Task<List<TeamName>> GetIpAddressDetails()
{
HttpClient client = new HttpClient();
try
{
HttpResponseMessage httpResponse = await client.GetAsync(adminURL);
var content = await httpResponse.Content.ReadAsStringAsync();
var resp = new StringContent(JsonConvert.SerializeObject(content), System.Text.Encoding.UTF8, "application/json");
return content
What I am trying to achieve is map the response which gets returned as JSON from my other API into a list of TeamName, the TeamName POCO matches exactly to what is in the API. It looks like this:
public class TeamName
{
[JsonProperty("guid")]
public Guid Guid { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("priorityNumber")]
public int PriorityNumber { get; set; }
}
I am confused on how to return the content as a list of TeamName
>(content);`
– MindSwipe Apr 13 '22 at 09:11