Hi,
i'm trying to edit an issue (status,summary,ecc..) from my website.
the url i'm trying to consume this API (Jira API i found at this link:
):
"{BaseUrl}/rest/api/3/issue/{TicketKey}/editmeta"
but the response return 405 (Method Not Allowed)
Here the code i written:
var obj = new UpdateViewModel { update = new UpdateTicketViewModel { summary = new List<UpdateSummary>() } };
obj.update.summary.Add(new UpdateSummary { set = model.Summary });
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Headers.Add("Authorization", $"Basic {Base64Encode(decrypted)}");
httpWebRequest.Headers.Add("Accept-Language", "en-US");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "PUT";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
json = JsonConvert.SerializeObject(obj);
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
Here the JSON i'm trying to post.
{"update":{"summary":[{"set":"TEST ANDREA"}]}}
Anyone can help me?
Thanks,
Andrea
Hi Andrea - The doc you pointed to is for Atlassian apps (add-ons). Here's the (very similar) call to edit an issue from an external source:
curl --request PUT \
--url '/rest/api/3/issue/{issueIdOrKey}' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fields": {
"summary": "Completed orders still displaying in pending"
}
}'
Thanks for the report. Now i'm trying to change the status of an issue but it not work.
This is the JSON i'm trying to post:
{
"fields":{
"summary":"TEST ANDREA 2"
},
"transition" : {"id" : "1001"}
}
The code i receive is 204 No Content. The summary changes but not the status.
Can i edit it by REST API or not?
Thanks,
Andrea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.