C# (C Sharp)

Simple example to retrieve information about an airframe, by registration and display some of the resulting data.

Code

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            string API_KEY ="TESTAPIKEY"; //Replace this with your own API KEY
            //string API_PASSWORD ="TESTAPIKEYPASSWORD"; //Replace this with your own API PASSWORD
            string API_ACCESS_TOKEN ="TESTAPIACCESSTOKEN"; //Replace this with your own API ACCESS TOKEN
            string API_BASE_URL="https://www.avdelphi.com/api/1.0/";
            string API_ENDPOINT="airframes";
            string API_COMMAND="info";
            string REGISTRATION="HB-JNB";
            string ITEMLIST="type_short;type_long;manufacturer";

            string targetUrl = API_BASE_URL + API_ENDPOINT +".svc?api_key=" + API_KEY + "&api_access_token=" + API_ACCESS_TOKEN  + "&cmd=" + API_COMMAND + "&registration=" + REGISTRATION + "&itemlist=" + ITEMLIST;

            System.Net.Http.HttpClient client = new HttpClient();
            Task<string> t = client.GetStringAsync(targetUrl);
            string result = t.Result;
            Console.WriteLine("Result JSON:\n{0}",result);

        }
    }
}


Copy to clipboard

Sample output