public object Post(dynamic model) { TraceRule rule = null; Site site = null; HttpRequestTracingId hrtId = null; if (model == null) { throw new ApiArgumentException("model"); } if (model.request_tracing == null) { throw new ApiArgumentException("request_tracing"); } if (!(model.request_tracing is JObject)) { throw new ApiArgumentException("request_tracing", ApiArgumentException.EXPECTED_OBJECT); } string hrtUuid = DynamicHelper.Value(model.request_tracing.id); if (hrtUuid == null) { throw new ApiArgumentException("request_tracing.id"); } hrtId = new HttpRequestTracingId(hrtUuid); site = hrtId.SiteId == null ? null : SiteHelper.GetSite(hrtId.SiteId.Value); string configPath = ManagementUnit.ResolveConfigScope(model); rule = RulesHelper.CreateRule(model, site, hrtId.Path, configPath); var section = Helper.GetTraceFailedRequestsSection(site, hrtId.Path, configPath); RulesHelper.AddRule(rule, section); ManagementUnit.Current.Commit(); dynamic r = RulesHelper.ToJsonModel(rule, site, hrtId.Path); return(Created(RulesHelper.GetLocation(r.id), r)); }