public dynamic CreateLanguage(LanguageDescriptor lang)
{
if (!LoggedIn)
throw new ApplicationException();
var request = MakePostRequest(ClassesLanguagePath);
var langjson = lang.Json;
request.AddParameter("application/json", langjson, ParameterType.RequestBody);
var response = Client.Execute(request);
if (response.StatusCode != HttpStatusCode.Created)
{
var message = new StringBuilder();
message.AppendLine("Request.Json: " + langjson);
message.AppendLine("Response.Code: " + response.StatusCode);
message.AppendLine("Response.Uri: " + response.ResponseUri);
message.AppendLine("Response.Description: " + response.StatusDescription);
message.AppendLine("Response.Content: " + response.Content);
throw new ApplicationException(message.ToString());
}
return JObject.Parse(response.Content);
}