Hi Team
Please help me my code are give below I am not able to post a comment in any issue . so please help me asap.
string result = string.Empty;
var jsonstring = @"{""update"":{""comment"": [ { ""add"": { ""body"": ""This is comment ""}}]}}";
try
{
//string restUrl = String.Format("{0}rest/api/2/issue/{1}/comment", Url, obj.issueid);
string postUrl = String.Format("{0}rest/api/2/issue/{1}", Url, obj.issueid);
HttpWebResponse response = null;
HttpWebRequest request = WebRequest.Create(postUrl) as HttpWebRequest;
request.Method = "PUT";
request.Accept = "application/json";
request.ContentType = "application/json";
request.Headers.Add("Authorization", "Basic " + GetEncodedCredentials(UserName, Password));
byte[] data = Encoding.UTF8.GetBytes(jsonstring);
using (Stream postStream = request.GetRequestStream())
{
postStream.Write(data, 0, data.Length);
}
using (response = request.GetResponse() as HttpWebResponse)
{
if (response.StatusCode == HttpStatusCode.Created)
{
}
}