document.write("
private static bool Enroll(string dna, string typingId)
{
TypingEnrolViewModel request = new TypingEnrolViewModel();
request.samples = new List<string>();
request.user_id = typingId;
request.samples.Add(dna);
string jsonObject = new JavaScriptSerializer().Serialize(request);
HttpResponse<String> response = Unirest.post("https://api.keytrac.net/anytext/enrol")
.header("Authorization", "XXXXX")
.header("Content-Type", "application/json")
.body(jsonObject)
.asJson<String>();
var result = response.Body;
var results = JsonConvert.DeserializeObject<TypingViewModel>(response.Body);
return results.OK;
}
Enroll - Snippet hosted by \"Cacher\"
namespace StudentExam.Model
{
public class TypingViewModel
{
public string id { get; set; }
public bool OK { get; set; }
public bool authenticated { get; set; }
public int score { get; set; }
}
public class TypingEnrolViewModel
{
public string user_id { get; set; }
public List<string> samples { get; set; }
}
}
Typing view model - Snippet hosted by \"Cacher\"
");