如何使用第一版REST数据API更新资产(状态和注释)?

时间:2016-12-14 15:02:36

标签: http-post jersey-client java-api versionone

我尝试使用下面的数据API更新资产。但是我无法更新它,它显示错误为错误请求。

String updateIssueData = "{\"Attributes\":{\"Status.Name\":{\"value\":"+"Done"+",\"act\":set}}}";
invokePostMethod("rest-1.v1/Data/Defect/1538",updateIssueData);

private static String invokePostMethod(String url, String data) throws AuthenticationException, ClientHandlerException {
    Client client = Client.create();
    WebResource webResource = client.resource(versionOneBaseURL+url);

    ClientResponse response = webResource.header("Authorization", "Bearer " + fToken).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class,data);

    int statusCode = response.getStatus();
    System.out.println("statuscode::"+statusCode);
    return response.getEntity(String.class);
}

0 个答案:

没有答案