Creating Webhook Returning 400 error code

test run December 4, 2019
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpWebRequest newPostRequest = WebRequest.Create(url) as HttpWebRequest;
newPostRequest.Method = "POST";
string base64Credentials = GetEncodedCredentials();
newPostRequest.Headers.Add("Authorization", "Basic " + base64Credentials);
newPostRequest.ContentType = "application/json; charset=utf-8";
using (var streamWriter = new StreamWriter(newPostRequest.GetRequestStream()))
{
string json = "[{\"name\":\"my first webhook via rest 5\",\"url\":\"https://www.example.com/webhooks\",\"events\":[\"jira:issue_created\",\"jira:issue_updated\"],\"filters\":{\"issue-related-events-section\":\"Project = JRA AND resolution = Fixed\"},\"excludeBody\":false}]";
Debug.Write(json);
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
string result = string.Empty;
try
{
var webresponse = (HttpWebResponse)newPostRequest.GetResponse();
var responseString = new StreamReader(webresponse.GetResponseStream()).ReadToEnd();
using (var Postresponse = newPostRequest.GetResponse() as HttpWebResponse)
{


Exception: {"The remote server returned an error: (400) Bad Request."}

ErrorMessages":["Can not deserialize instance of com.atlassian.webhooks.plugin.rest.WebHookListenerJsonBean out of START_ARRAY token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@31f3cefb; line: 1, column: 1]"

Any Solutions Please?




 

0 answers

Suggest an answer

Log in or Sign up to answer