is there a specific error you are getting back?
It should really be no harder than passing the following to REST API - which method did you use? I seem to recognize from documentation the request should be of type 'PUT'.
It should work that way:
{"fields":{"description":"my new description"}}
For the URL I'd say it is:
PUT /rest/api/2/issue/issuekey
Let us know if it proceeded well, please.
Cheers,
Daniel
Hello @Daniel Ebers
I am using V3 api in which we can not directly send description in fields object like this {"fields":{"description":"my new description"}}
though in V2 its working but I want the solution for V3
Thank You!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There still might be deviances between v2 and v3 API - why I am not confident it definitely works in v3 API.
You probably could also check with Developer Community (https://community.developer.atlassian.com/tag/rest-api) - guessing there are more users specialicing in integration questions with API and coding.
You also could wait here for more input but an older thread normally does not get that much attention after a few days.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everyone below java code helps to update jira issue name and description in Jira.
I think this will help you.
It is working for me.
JsonNodeFactory jnf = JsonNodeFactory.instance;
ObjectNode payload = jnf.objectNode();
{
ObjectNode update = payload.putObject("update");
{
ArrayNode summary = update.putArray("summary");
ObjectNode summary0 = summary.addObject();
{
summary0.put("set", Name);
}
}
ObjectNode fields = payload.putObject("fields");
ObjectNode description = fields.putObject("description");
{
description.put("type", "doc");
description.put("version", 1);
ArrayNode content = description.putArray("content");
ObjectNode content0 = content.addObject();
{
content0.put("type", "paragraph");
content = content0.putArray("content");
content0 = content.addObject();
{
content0.put("text", Description);
content0.put("type", "text");
}
}
}
}
// Connect Jackson ObjectMapper to Unirest
Unirest.setObjectMapper(new ObjectMapper() {
private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper
= new com.fasterxml.jackson.databind.ObjectMapper();
public <T> T readValue(String value, Class<T> valueType) {
try {
return jacksonObjectMapper.readValue(value, valueType);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String writeValue(Object value) {
try {
return jacksonObjectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
});
// This code sample uses the 'Unirest' library:
// http://unirest.io/java.html
HttpResponse<JsonNode> response = Unirest.put("https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}")
.basicAuth("email@example.com", "<api_token>")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(payload)
.asJson();
System.out.println(response.getBody());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Everyone below is the java code for updating issue name and description in Jira.
I think this will help you.
It is working for me.
JsonNodeFactory jnf = JsonNodeFactory.instance;
ObjectNode payload = jnf.objectNode();
{
ObjectNode update = payload.putObject("update");
{
ArrayNode summary = update.putArray("summary");
ObjectNode summary0 = summary.addObject();
{
summary0.put("set", Name);
}
}
ObjectNode fields = payload.putObject("fields");
ObjectNode description = fields.putObject("description");
{
description.put("type", "doc");
description.put("version", 1);
ArrayNode content = description.putArray("content");
ObjectNode content0 = content.addObject();
{
content0.put("type", "paragraph");
content = content0.putArray("content");
content0 = content.addObject();
{
content0.put("text", Description);
content0.put("type", "text");
}
}
}
}
// Connect Jackson ObjectMapper to Unirest
Unirest.setObjectMapper(new ObjectMapper() {
private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper
= new com.fasterxml.jackson.databind.ObjectMapper();
public <T> T readValue(String value, Class<T> valueType) {
try {
return jacksonObjectMapper.readValue(value, valueType);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String writeValue(Object value) {
try {
return jacksonObjectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
});
// This code sample uses the 'Unirest' library:
// http://unirest.io/java.html
HttpResponse<JsonNode> response = Unirest.put("https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}")
.basicAuth("email@example.com", "<api_token>")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(payload)
.asJson();
System.out.println(response.getBody());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The JIRA cloud rest api documentation on edit issue should help you with this -> https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Fazila Ashraf
I am using V3 version in which they dint have field for description in edit issue api. can you help me that?
Thank you !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put also has description field also.
Which documentation are you referring to?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Fazila Ashraf
I am referring the same documentation.
The description field in this api is in the historyMetadata object which doesn't update the description field in jira.
We can't pass description field in 'update' or 'fields' objects in this api which actually updates the jira filelds.
Thank you !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also found myself on this struggle, I'm trying to udpate the description but I'm also getting error 400 BAD REQUEST, based on how the description is actually being shown in the API I wouldn't be surprised if the documentation for such field was erroneous
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same problem here. When I try to update description I'm getting a 400 error code too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.