mogoli mogoli - 3 months ago 12
Java Question

Edit JIRA Issues Java Rest

I have tried to google this, but can't seem to get a good clear answer on this.

I'm trying to edit JIRA issues using Java via the JIRA REST API.

Can anyone provide a full example of editing a custom or standard field including library declarations? Completely new to REST and JIRA.

I can't use plugins as I'll be working with multiple JIRA instances and I don't control the JIRA server I'm connecting to.

I found this:

But I don't understand it.

Thanks for your help :)


Manged to find a way using the Jira REST and the Jersey Library. Currently, Jira's Java API supports reading and creating tickets but not editing.

package jiraAlerting;


import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;

public class restLab {

    WebResource webResource;
    static {
        //for localhost testing only

            public boolean verify(String hostname,
           sslSession) {
                if (hostname.equals("your host here")) {
                    return true;
                return false;

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        restLab rl = new restLab();



    public void connectToJiraViaRest(){
        //System.setProperty("", "C:/SSL/clientkeystore.jks");

        Client client = Client.create();
        client.addFilter(new HTTPBasicAuthFilter("username","password"));

        webResource = client.resource("https://host/jira/rest/api/2/issue/issueID");


    public void editJiraTicket(){

        ClientResponse response = webResource.type("application/json").put(ClientResponse.class,"{\"fields\":{\"customfield_11420\":{\"value\" :\"No\"}}}");