Use c-sharp code to post to TurnkeyRest
No edit summary
No edit summary
Line 14: Line 14:
   }
   }
</pre>It is important to supply a boundary token both in request and header or the Turnkey server will not be able to parse the values (this is same for all asp.net servers)
</pre>It is important to supply a boundary token both in request and header or the Turnkey server will not be able to parse the values (this is same for all asp.net servers)
[[Category:C-Sharp]]
[[Category:MDriven Turnkey]]

Revision as of 08:56, 8 December 2022

  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 both in request and header or the Turnkey server will not be able to parse the values (this is same for all asp.net servers)

This page was edited 94 days ago on 06/17/2024. What links here