Sample:
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace DDOTPermitAPISample
{
static class Program
{
static void Main(string[] args)
{
SendConstructionPermitRequest().Wait();
SendSingleConstructionPermitRequest().Wait();
SendDocumentRequestForAPermit().Wait();
}
private static async Task SendConstructionPermitRequest()
{
var uri = new UriBuilder(Uri.UriSchemeHttps, "TOPSAPI.ddot.dc.gov")
{
Path = "/api/Construction/",
Query = "PageSize=5&StartRow=0&SortColumn=TrackingNumber" // Add additional Filter Parameters here.
};
using (var http = new HttpClient())
{
http.DefaultRequestHeaders.Accept.Clear();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Paste Your License Key Here");
var response = http.GetAsync(uri.Uri).Result;
http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
System.Diagnostics.Debug.Write(result);
}
}
private static async Task SendSingleConstructionPermitRequest()
{
var uri = new UriBuilder(Uri.UriSchemeHttps, "TOPSAPI.ddot.dc.gov")
{
Path = "/api/Construction/Get/",
Query = "id=100000" // Send Tracking Number
};
using (var http = new HttpClient())
{
http.DefaultRequestHeaders.Accept.Clear();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Paste Your License Key Here");
var response = http.GetAsync(uri.Uri).Result;
http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
System.Diagnostics.Debug.Write(result);
}
}
private static async Task SendDocumentRequestForAPermit()
{
var uri = new UriBuilder(Uri.UriSchemeHttps, "TOPSAPI.ddot.dc.gov")
{
Path = "/api/Documents/Get/",
Query = "trackingnumber=10266438" // Send Tracking Number
};
using (var http = new HttpClient())
{
http.DefaultRequestHeaders.Accept.Clear();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Paste Your License Key Here");
var response = http.GetAsync(uri.Uri).Result;
http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
System.Diagnostics.Debug.Write(result);
}
}
}
}