AnsweredAssumed Answered

Rest call for delegate task

Question asked by priyankam on Jul 31, 2014
Latest reply on Jul 31, 2014 by frederikheremans1

   @RequestMapping(value = "/delegateTask/{taskId}", method = RequestMethod.PUT)
   @ResponseBody
   public StatusDetails delegateTask(
         @PathVariable("taskId") String planItemAggregateId,
         @RequestParam("userId") String userId,
         @RequestParam("comment") String comment) {
      StatusDetails statusDetails = new StatusDetails();
      try {
         cmmnEngineRuntimeService.delegateTask(planItemAggregateId, userId,
               comment);
         String successMessage = "You have Delegated the Task";
         statusDetails.setId(planItemAggregateId);
         statusDetails.setMessage(successMessage);
         statusDetails.setStatus("success");
         return statusDetails;
      } catch (Exception e) {
         String failedMessage = "You have failed to Delegate the Task ";
         statusDetails.setId(null);
         statusDetails.setMessage(failedMessage + e.getMessage());
         statusDetails.setStatus("error");
         return statusDetails;
      }

   }
This my code but i want to know whether i can use @requestparam for put method or I should use reaquestBody and will it correct way of doing it for comment field and userId.

Outcomes