How to update an asset (status and comment) using version one REST data API?

215 views Asked by At

I'm trying to update an asset using data API like below. But I am unable to update it, it is showing an error as Bad request.

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

There are 0 answers