Created
December 9, 2021 14:39
-
-
Save yuriycto/b1f42b4a116f106aa2e073f2a55e9793 to your computer and use it in GitHub Desktop.
Send to Acumatica
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Net; | |
using Newtonsoft.Json; | |
| |
namespace ConsoleApp1 | |
{ | |
public class ObjectJSON | |
{ | |
public string Name { get; set; } | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var URL = "http://localhost/WebHooks/Webhooks/WebHooksConfiguration/0a152235-121e-4a20-b425-a2239011f0b3"; | |
var httpRequest = (HttpWebRequest)WebRequest.Create(URL); | |
httpRequest.Method = "POST"; | |
httpRequest.Accept = "application/json"; | |
httpRequest.ContentType = "application/json"; | |
| |
string obj = JsonConvert.SerializeObject(new ObjectJSON { Name = "Test WebHooks" }); | |
using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream())) | |
{ | |
streamWriter.Write(obj); | |
} | |
| |
var httpResponse = (HttpWebResponse)httpRequest.GetResponse(); | |
using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) | |
{ | |
var result = streamReader.ReadToEnd(); | |
} | |
| |
Console.WriteLine(httpResponse.StatusCode); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment