Im trying to update a field in an issue over REST API. But I always get "MethodNotAllowed" Error when I drop a Put request. GET requests work. Anybody know what I am doing wrong?
Community moderators have prevented the ability to post new answers.
Before I get into coding against a REST API, I usually try to access the resource through curl or some basic client that I have full control over. Another tool you can try out is the Atlassian REST API Browser. We just installed this on our public JIRA instance. You can access it here: https://jira.atlassian.com/plugins/servlet/restbrowser#/com-atlassian-jira-rest-jira-rest-filter
Make sure you log in first.
thanks. this looks like a good plugin. where can I get it?
It seams to me that the PUT request is not yet implementet as I can not see such a request in the REST Browser for
But it is documented in http://docs.atlassian.com/jira/REST/5.0-rc2/#id3419201
Is there an example somewhere how to update a field in an issue over REST
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For now, you can install it in UPM with this URL: https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/devrel/developer-toolbox-plugin/1.1-rc2/developer-toolbox-plugin-1.1-rc2.jar
We're in the process of adding it to the Plugin Exchange.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry... forgot to answer your question re: editmeta. I don't see a PUT method on editmeta in the documentation:
http://docs.atlassian.com/jira/REST/5.0-rc2/#id3419731
Only a get.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ah yes I just saw. There is a PUT methiod on
But when I try to update the summery field it sais "bad request". I'm sure Im forming the json wrong. But I can't figure out how. Here is my code:
var request = new RestRequest();
request.RequestFormat = DataFormat.Json;
request.Method = RestSharp.Method.PUT;
request.AddBody(new { summary = "test" });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Im a big step further now but I get this error from jira: errorMessages\":[],\"errors\":{\"summary\":\"Operation value must be a string
code:
var json = new JObject(
new JProperty("update",new JObject(new JProperty("summary",
new JArray(
new JObject(
new JProperty("set","test01" )))))));
var request = new RestRequest();
request.RequestFormat = DataFormat.Json;
request.Method = RestSharp.Method.PUT;
request.AddBody(json);
RestResponse response = client.Execute(request);
string content = response.Content;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here... try this...
Basically, your PUT should have the following body:
{ "fields": { "summary": "A new summary" } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you. This works over the REST browser Plugin. But when I send the same string over my c# app i get the following error:
Content = "{\"errorMessages\":[\"Can not deserialize instance of com.atlassian.jira.rest.v2.issue.IssueUpdateBean out of VALUE_STRING token\\n at [Source: org.apache.catalina.connector.CoyoteInputStream@54046d9c; line: 1, column: 1]\"]}"
If I serialize it as a json I get this:
Content = "{\"errorMessages\":[],\"errors\":{\"summary\":\"Operation value must be a string\"}}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@e3k do you have any way of sniffing the actual request/response the gets sent/received? I'm not a C#'er.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the tipp. It looks like a bug in this third party REST client that I used. It did not send the string correctly. I switched to the basig HTTPRequest and it works now. Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
e3k - would you be prepared to share some of your .NET code?
I am using a WebRequest, but it is failing with an annoying "(400) Bad Request" error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version? There doesn't seem to be any such method... http://docs.atlassian.com/jira/REST/latest/
POST is the normal verb for updating, but that doesn't seem possible either.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
http://docs.atlassian.com/jira/REST/5.0-rc2/#id3419065
I've installed this version. Hoped it would work..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, my bad... sorry, not sure then.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var jsonDataSerialize = request.JsonSerializer.Serialize(jsonData);
request.RequestFormat = DataFormat.Json;
request.Method = RestSharp.Method.PUT;
request.AddBody(JSONSharp.Values.JSONStringValue.ToJSONString(@"{""update"": {""summary"": [{""set"": ""Bug in business logic""]}}"));
RestResponse response = client.Execute(request);
string content = response.Content;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.