public void StoreXml(string host, string filename, string culture, string token){
var client = new RestClient(host + "/Congree/api/AuthoringMemory/v1/ImportXml?lang=" + culture);
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("Authorization", "Bearer " + token);
request.AddHeader("Content-Type", "multipart/form-data");
request.AlwaysMultipartFormData = true;
request.AddFile("file", filename, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}
Parameter | Description |
---|
host | The address of the server hosting Congree Authoring Server |
filename | The name of the file to be imported. The file must be either a valid file, e.g. the referenced DTD must be accessible or a well-formed XML file. |
culture | The code of the language the imported file is written in. |
token | The Bearer token acquired during the authentication. |
Searching for sentences in the Authoring Memory
public void SearchSentence(string host, string ruleSet, string token, string sentence){
var client = new RestClient(host + "/Congree/api/AuthoringMemory/v1/Search");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer " + token);
request.AddParameter("undefined", "{ \n \"Xml\": \" + sentence + "\",\n \"RuleSetName\": \" + ruleSet + "\" \n }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}
Parameter | Description |
---|
host | The address of the server hosting Congree Authoring Server |
ruleSet | The name of the ruleset the sentence is checked with. |
token | The Bearer token acquired during the authentication. |
sentence | A well-formed XML structure. |
The request returns a JSON object that is described in the Reference Manual.