Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Creating Webhook Returning 400 error code

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you