using System.Net.Http.Headers;
using Newtonsoft.Json.Linq;
namespace APICallSample {
static HttpClient client = new HttpClient();
static void initilizeClient() {
client.BaseAddress = new Uri("https://reqres.in/api/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
static void printNames() {
var response = client.GetAsync("users").Result;
response.EnsureSuccessStatusCode();
var stringResponse = response.Content.ReadAsStringAsync().Result;
var data = JObject.Parse(stringResponse);
foreach (var row in data["data"]) {
string fullName = row["first_name"] + " " + row["last_name"];
Console.WriteLine(fullName);
public static void Main(string[] args)