Zum Ende der Metadaten springen
Zum Anfang der Metadaten

Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

Version 1 Nächste Version anzeigen »

Authoring Memory

Storing XML files into the Authoring Memory


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);

}
ParameterDescription
hostThe address of the server hosting Congree Authoring Server
filenameThe 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.
cultureThe code of the language the imported file is written in.
tokenThe 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);
}
ParameterDescription
hostThe address of the server hosting Congree Authoring Server
ruleSetThe name of the ruleset the sentence is checked with.
tokenThe Bearer token acquired during the authentication.
sentenceA well-formed XML structure.

The request returns a JSON object that is described in the Reference Manual. 

  • Keine Stichwörter