Created
October 22, 2012 22:05
-
-
Save sirkirby/3934885 to your computer and use it in GitHub Desktop.
RyanTech VIN Explosion API Decode VIN w/ Asp.Net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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