2012-05-17 2 views
1

JIRA 나머지 API를 통해 문제의 fixVersion을 업데이트하려고합니다. JIRA 버전은 4.4.3 # 663-r165197입니다. codehaus에 의해 호스팅되는 인스턴스입니다. 차이가 있는지 여부는 확실하지 않습니다. 나는 (405), 방법은 허용되지 않는 오류가 다시 얻을JIRA 나머지 API로 문제 업데이트하기 4.4

 
    curl -u [username]:[password] -X PUT -H 'Content-type: application/json' \ 
    -d "http://jira.codehaus.org/rest/api/latest/issue/GEOS-[id]" 
 
{ 
    "update":{ 
     "fixVersions":[ 
     { 
      "set":[ 
       { 
        "name":"2.2-beta3" 
       } 
      ] 
     } 
     ] 
    } 
} 

그러나 : 같은

요청 보인다. 어떤 버전을위한 나머지 API 문서를 보면 말이됩니다. 이 방법으로 문제를 업데이트 할 수있는 방법이 없다는 것을 나타냅니다. 필자는 최신 버전의 문서를 보면 가능하다고 나타납니다.

그래서 JIRA 4.4에서 이런 방식으로 문제를 어떻게 업데이트합니까? 아니면 불가능한가요?

감사합니다.

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

[2] 당신은 SOAP의 updateIssue 방법을 사용해야합니다 4.4 http://docs.atlassian.com/jira/REST/latest/#id165544

답변

1

. 5.0에서이 문제가 해결되었습니다.

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.