Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

Authoring Memory

Storing XML files into the Authoring Memory

Codeblock
languagec#
linenumberstrue
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);

}

...

Searching for sentences in the Authoring Memory

Codeblock
languagec#
linenumberstrue
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);
}

...

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

Inhalt