-
1. Re: How to call reset api for human task from external source
abhijithumbe Mar 17, 2016 4:57 AM (in response to mjaradat)Try with below code to perform task operation:
String url = "http://localhost:8080/business-central/rest/task/3/start";
try {
ClientRequest cr = new ClientRequest(url)
.header("Authorization", getAuthHeader(user, password))
.accept(MediaType.APPLICATION_XML)
.queryParameter("map_VariableName", "ABC");
ClientResponse<String> response = cr.post(String.class);
System.out.println(response.getEntity(String.class));
if (response.getStatus() == 200) {
// System.out.println("200 "+response.getEntity(String.class));
}
} catch (Exception e) {
e.printStackTrace();
}
private static String getAuthHeader(String username, String password) {
String auth = username + ":" + password;
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset
.forName("US-ASCII")));
return "Basic " + new String(encodedAuth);
}
Hope it helps..