Hi,
I have successfully managed to search for issues, create and edit versions in Jira via the REST API but I am really struggling to update any issues.
Whenever I try to use a PUT to update individual fields I get the horrible 400 Bad Request error and no extra details to tell me why the request is bad - this error is just as good as saying "something hasn't worked".
My C# code is as follows (please note that I have just put everything into one bit of code here to show the workings - the creation of web request and response is working perfectly for versions):
var request = WebRequest.Create("http://jira-devt:8080/rest/api/2/issue/51850");
request.Method = "PUT";
request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("admin:password")));
request.ContentType = "application/json";
var json = string.Format("{{ \"update\": {{\"summary\": [{{\"set\": \"plop\"}}] }} }};");
request.GetRequestStream().Write(Encoding.ASCII.GetBytes(json), 0, json.Length);
var response = request.GetResponse();
var reader = new StreamReader(response.GetResponseStream());
var output = reader.ReadToEnd();
Looking at other posts I should be able to see what issue fields I can update by putting the following in my browser:http://jira-devt:8080/rest/api/2/issue/SUN-2743/editmeta
... and when I do I get the following response:
{"fields":{}}
So my questions:
- How can I diagnose the 400 error a bit further to find out what is going on?
- Why is my update not working? I have tried various methods detailed in the API documentation.
- Should 'editmeta' show more stuff? I can edit successfully in the UI.
Any help will be much appreciated!