oclockvn
9/19/2015 - 10:30 AM

get-values.cs

var api = new ApiHelper("http://localhost:60847");

// login
var login = api.Post("/token", 
    new StringContent(
        string.Format("username={0}&password={1}&grant_type=password", 
        "oclockvn@gmail.com", 
        "123456")));

var jss = new JavaScriptSerializer();

// parse response object and get token
var json = jss.Deserialize<dynamic>(login.ToString());
var token = json["access_token"];

// get values with token
var values = api.Get("/api/values", token);