Versionen im Vergleich

Schlüssel

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

Inhalt

Introduction

...

Getting an authentication token

To be able to use the functionality provided in the REST API it is necessary to obtain an authentication token that will be used in all of the requests dedicated to do linguistics checks. 

In this section we will be creating a class that does all the work for us. The basic skeleton of the class is shown in the listing below:

...

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

}

...