1

JIRA REST API を介して課題の fixVersion を更新しようとしています。JIRA のバージョンは 4.4.3#663-r165197 です。これは codehaus によってホストされているインスタンスですが、それが違いを生むかどうかはわかりません。

リクエストは次のようになります。

  curl -u [ユーザー名]:[パスワード] -X PUT -H 'Content-type: application/json' \
    -d "http://jira.codehaus.org/rest/api/latest/issue/GEOS-[id]"
{
   "アップデート":{
      "修正バージョン":[
         {
            "設定":[
               {
                  「名前」:「2.2-beta3」
               }
            ]
         }
      ]
   }
}

しかし、405、メソッドは許可されていないというエラーが返されます。そのバージョンの残りのAPIドキュメントを見ると、これは理にかなっています[1]。この方法で問題を更新する方法がないことを示しているようです。しかし、最新バージョン [2] のドキュメントを見ると、それが可能であることを示しているようです。

問題は、JIRA 4.4 でこの方法で課題を更新するにはどうすればよいかということだと思います。それとも無理ですか?

ありがとう!

[1] https://developer.atlassian.com/static/rest/jira/4.4.1.html#id151460

[2] http://docs.atlassian.com/jira/REST/latest/#id165544

4

2 に答える 2

2

4.4 では、SOAP updateIssue メソッドを使用する必要があります。5.0 ではこれが修正されました。

于 2012-05-17T18:06:40.403 に答える
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.
于 2016-05-22T14:02:47.250 に答える