Use c-sharp code to post to TurnkeyRest
No edit summary
(Updated Edited template to July 12, 2025.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
<pre>
<pre>
   var cli = new System.Net.Http.HttpClient();
   var cli = new System.Net.Http.HttpClient();
Line 13: Line 14:
   {
   {
   }
   }
</pre>It is important to supply a boundary token both in the request and header. Otherwise, the Turnkey server will not be able to parse the values (this is the same for all asp.net servers).
</pre>It is important to supply a boundary token in the request and header. Otherwise, the Turnkey server will not parse the values (this is the same for all asp.net servers).
[[Category:C-Sharp]]
[[Category:C-Sharp]]
[[Category:MDriven Turnkey]]
[[Category:MDriven Turnkey]]
{{Edited|July|12|2025}}

Latest revision as of 06:24, 20 January 2025

This page was created by Hans.karlsen@mdriven.net on 2020-05-17. Last edited by Edgar on 2025-01-20.
  var cli = new System.Net.Http.HttpClient();
  var requestContent = new System.Net.Http.MultipartFormDataContent("--BOUNDARY");


  requestContent.Add(new System.Net.Http.StringContent("DataToAmountVMCol"), "Amount");
  requestContent.Add(new System.Net.Http.StringContent("DataToMessageVMCol"), "Message");
  requestContent.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/form-data; boundary=--BOUNDARY");

  var url= "https://yoursystem";
  var res = cli.PostAsync(url+ "/TurnkeyRest/Post?command=Consume&id=" + TurnkeySettingFromFile.TurnKeySetting_PortalGuid, requestContent).Result;
  if (res.IsSuccessStatusCode)
  {
  }

It is important to supply a boundary token in the request and header. Otherwise, the Turnkey server will not parse the values (this is the same for all asp.net servers).

MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments