Use c-sharp code to post to TurnkeyRest
Hans Karlsen (talk | contribs) (Created page with "<pre> var cli = new System.Net.Http.HttpClient(); var requestContent = new System.Net.Http.MultipartFormDataContent("--BOUNDARY"); requestConte...") |
Hans Karlsen (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<pre> | <pre> | ||
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) | |||
{ | |||
} | |||
</pre> | </pre> |
Revision as of 14:56, 17 May 2020
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) { }
This page was edited more than 11 months ago on 02/10/2024. What links here