Thanks for your adivces, Martin, I'll use this approach on other projects.
For now, I came to this solution, may be, it would be useful for someone
System.Net.HttpWebRequest webRequest;
System.Net.HttpWebResponse webResponse;
System.IO.Stream stream;
System.IO.StreamReader streamReader;
System.Byte[] bytes;
System.Net.WebHeaderCollection headers;
str response;
System.Text.UTF8Encoding encoding;
str apiKey = 'My API Key';
;
new InteropPermission(InteropKind::ClrInterop).assert();
webRequest = System.Net.WebRequest::Create('myawesomeservice.com') as System.Net.HttpWebRequest;
//Making header collection and setting the requisites
headers = new System.Net.WebHeaderCollection();
headers.Add("Authorization: Token " + apiKey);
webRequest.set_Headers(headers);
webRequest.set_Method('POST');
webRequest.set_ContentType('application/json');
webRequest.set_Accept(''application/json'');
webRequest.set_Timeout(5000);
//setting encoding
encoding = new System.Text.UTF8Encoding();
bytes = encoding.GetBytes("{ \"query\": \"my query text\" }");
webRequest.set_ContentLength(bytes.get_Length());
stream = webRequest.GetRequestStream();
stream.Write(bytes, 0, bytes.get_Length());
stream.Close();
webResponse = webRequest.GetResponse();
stream = webResponse.GetResponseStream();
streamReader = new System.IO.StreamReader(stream);
response = streamReader.ReadToEnd();
streamReader.Close();
stream.Close();
CodeAccessPermission::revertAssert();