...
Codeblock |
---|
language | c# |
---|
linenumbers | true |
---|
|
private static string GetContext(int num, CongreeCheckresult result)
{
string pattern = @"<\?cngr-ctx-b " + num + @"\?>(.+)<\?cngr-ctx-e " + num + @"\?>";
MatchCollection matches = Regex.Matches(result.ResultXml, pattern);
if (matches.Count > 0) {
return matches[0].Value;
}
return "";
} |
The method to store a paragraph related report is shown below:
Codeblock |
---|
language | c# |
---|
linenumbers | true |
---|
|
public void StoreParagraphReport(string sessionid, string paragraphid, CongreeRestApiSample.Reporting.Congree.ParagraphReport message)
{
var client = new RestClient(this.serverUrl + "/congree/api/Linguistic/Reporting/v1/Sessions/" + sessionid + "/Paragraphs/" + paragraphid);
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer " + this.token);
var jsonmessage = JsonConvert.SerializeObject(message);
request.AddParameter("undefined", jsonmessage, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
} |
The parameter message is an object of the class ParagraphReport shown below.
Codeblock |
---|
language | c# |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CongreeRestApiSample.Reporting.Congree
{
public class Error
{
public int ErrorId { get; set; }
public string ErrorType { get; set; }
public string ErrorCode { get; set; }
public string Notification { get; set; }
public List<string> Proposals { get; set; }
public string Status { get; set; }
}
public class ParagraphReport
{
public List<Error> Errors { get; set; }
public string Context { get; set; }
}
}
|
If the document check yields no errors pass for each paragraph/context as request with the context only, i.e. the Errors arry is empty. If the context is an empty string, don't store it.
Property in Paragraph Report | Property in CongreeCheckResult |
---|
ErrorId | Id in Errors |
ErrorType | Type in Errors |
ErrorCode | Code in Errors |
Notification | Header in Descriptions/Description |
Proposals | An array containing the strings in Text in each Proposal |
Status | The information on the status, e.g. how the user dealt with the issue. Possible values are "Normal", "Ignored", "Disregarded" |