Skip to content

Instantly share code, notes, and snippets.

@sirkirby
Created October 22, 2012 22:05
Show Gist options
  • Save sirkirby/3934885 to your computer and use it in GitHub Desktop.
Save sirkirby/3934885 to your computer and use it in GitHub Desktop.
RyanTech VIN Explosion API Decode VIN w/ Asp.Net
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://vinexplosion.com/api/vin/");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
// make the request and capture the response
var result = client.GetAsync("decode/JA4AP3AU5BZ009787/?fuzzy=true").Result;
// grab the json
var json = result.Content.ReadAsStringAsync().Result;
var rvef = JObject.Parse(json);
var year = (string)rvef.SelectToken("Vehicles[0].Providers[0].Year");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment