using System.Collections.Generic;
using System.Threading.Tasks;
using System.Net.Http.Headers;
using System.Text.Json.Serialization;
public static async Task Main()
ISampleServices sampleServices = new SampleServices();
var healthProfessions = await sampleServices.GetHealthProfessionsAsync();
foreach(var item in healthProfessions)
Console.WriteLine(item.ShortName);
public interface ISampleServices
Task<List<SampleServiceResponse>> GetHealthProfessionsAsync();
public class SampleServices : ISampleServices
private HttpClient _client = new HttpClient();
public async Task<List<SampleServiceResponse>> GetHealthProfessionsAsync()
var serviceResponse = await _client.GetAsync("https://api.sampleapis.com/health/professions");
string json = await serviceResponse.Content.ReadAsStringAsync();
public class SampleServiceResponse
[JsonPropertyName("long_name")]
public string LongName {get; set;}
[JsonPropertyName("short_name")]
public string ShortName{get; set;}
public int Id {get; set;}