CSharp · Console
using System;
using unirest_net.http;
public class Program
{
public static void Main()
{
Console.WriteLine("Start ...");
var response = Unirest.get("https://jsonplaceholder.typicode.com/todos/1")
.header("X-RapidAPI-Host", "api-nba-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "myKey")
.asJson<RootObject>();
if (response.Code == 200) // Success, OK in HTTP Codes
{
var result = response.Body; // which body has the type of MyClass.RootObject
Console.WriteLine(result.title);
}
Console.WriteLine("End ....");
Console.ReadLine();
}
}
public class RootObject
{
public int userId { get; set; }
public int id { get; set; }
public string title { get; set; }
public bool completed { get; set; }
}