使用JIRA rest api 4.4更新问题

使用JIRA rest api 4.4更新问题,jira,Jira,我正在尝试通过JIRA rest api更新问题的修复版本。JIRA版本为4.4.3#663-r165197。它是由codehaus托管的实例,不确定这是否会产生影响 请求如下所示: curl -u [username]:[password] -X PUT -H 'Content-type: application/json' \ -d "http://jira.codehaus.org/rest/api/latest/issue/GEOS-[id]" curl-u[username]

我正在尝试通过JIRA rest api更新问题的修复版本。JIRA版本为4.4.3#663-r165197。它是由codehaus托管的实例,不确定这是否会产生影响

请求如下所示:

curl -u [username]:[password] -X PUT -H 'Content-type: application/json' \ -d "http://jira.codehaus.org/rest/api/latest/issue/GEOS-[id]" curl-u[username]:[password]-X PUT-H'Content type:application/json'\ -d“http://jira.codehaus.org/rest/api/latest/issue/GEOS-[id]。” { “更新”:{ “固定版本”:[ { “设置”:[ { “名称”:“2.2-beta3” } ] } ] } } 但我得到一个405,方法不允许的错误。如果我查看该版本的RESTAPI文档[1],这是有意义的。它们似乎表明无法以这种方式更新问题。但如果我看一下最新版本的文档[2],它们似乎表明这是可能的

所以我想问题是如何在JIRA 4.4中以这种方式更新问题?还是不可能

谢谢

[1]


[2]

对于4.4,您必须使用SOAP UpdateSue方法。5.0修复了这个问题

Prepare Json data as below(Here java as technology i had used), and pass using put method/API.

public static String generateJson(String customFieldId, Object value,
        String attribute) {

    if (isBlankOrNull(attribute)) {
        return "\"" + customFieldId + "\":" + "\"" + value + "\"";
    } else {
        return "\"" + customFieldId + "\":{\"" + attribute + "\":\"" + ""
                + value + "\"}";
    }
}



    public static int invokePutMethod(String auth, String url, String data) {

            int statusCode = 0;
            try {
                Client client = Client.create();
                WebResource webResource = client.resource(url);
                ClientResponse response = webResource
                        .header("Authorization", "Basic " + auth)
                        .type("application/json").accept("application/json")
                        .put(ClientResponse.class, data);
                statusCode = response.getStatus();
                return statusCode;
            } catch (Exception e) {
                Constants.ERROR.info(Level.INFO, e);
                // vjErrorLog.info(Level.INFO, e);
            }
            return statusCode;
        }

attribute could be key, id, name, value etc,

In case of fix version or components, you may have one more way to prepare json data

    return "\"" + customFieldId + "\":[{\"set\" :[{ \"" + attribute
                        + "\" :" + "\"" + data + "\"}]}]";

and invoke put method with above json data.
Prepare Json data as below(Here java as technology i had used), and pass using put method/API.

public static String generateJson(String customFieldId, Object value,
        String attribute) {

    if (isBlankOrNull(attribute)) {
        return "\"" + customFieldId + "\":" + "\"" + value + "\"";
    } else {
        return "\"" + customFieldId + "\":{\"" + attribute + "\":\"" + ""
                + value + "\"}";
    }
}



    public static int invokePutMethod(String auth, String url, String data) {

            int statusCode = 0;
            try {
                Client client = Client.create();
                WebResource webResource = client.resource(url);
                ClientResponse response = webResource
                        .header("Authorization", "Basic " + auth)
                        .type("application/json").accept("application/json")
                        .put(ClientResponse.class, data);
                statusCode = response.getStatus();
                return statusCode;
            } catch (Exception e) {
                Constants.ERROR.info(Level.INFO, e);
                // vjErrorLog.info(Level.INFO, e);
            }
            return statusCode;
        }

attribute could be key, id, name, value etc,

In case of fix version or components, you may have one more way to prepare json data

    return "\"" + customFieldId + "\":[{\"set\" :[{ \"" + attribute
                        + "\" :" + "\"" + data + "\"}]}]";

and invoke put method with above json data.