@GET
 @Path("/event/{eventId}")
 @Produces(APPLICATION_JSON)
 @ApiOperation(value = "Get an existing Event.", response = Event.class)
 @ApiResponses(
     value = {
       @ApiResponse(code = 200, message = "Success, Event found."),
       @ApiResponse(code = 404, message = "Event not found.", response = ApiError.class),
       @ApiResponse(code = 500, message = "Internal server error.", response = ApiError.class)
     })
 public Response getEvent(
     @ApiParam(value = "Id of Event to be retrieved.", required = true) @PathParam("eventId")
         final String eventId,
     @ApiParam(
             required = false,
             value = "Return only a thin event, do not include: evalSets, dampening.")
         @QueryParam("thin")
         final Boolean thin) {
   try {
     Event found =
         alertsService.getEvent(tenantId, eventId, ((null == thin) ? false : thin.booleanValue()));
     if (found != null) {
       if (log.isDebugEnabled()) {
         log.debug("Event: " + found);
       }
       return ResponseUtil.ok(found);
     } else {
       return ResponseUtil.notFound("eventId: " + eventId + " not found");
     }
   } catch (Exception e) {
     log.debug(e.getMessage(), e);
     return ResponseUtil.internalError(e);
   }
 }
 @POST
 @Path("/")
 @Consumes(APPLICATION_JSON)
 @Produces(APPLICATION_JSON)
 @ApiOperation(
     value = "Create a new Event.",
     notes = "Returns created Event.",
     response = Event.class)
 @ApiResponses(
     value = {
       @ApiResponse(code = 200, message = "Success, Event Created."),
       @ApiResponse(code = 500, message = "Internal server error.", response = ApiError.class),
       @ApiResponse(
           code = 400,
           message = "Bad Request/Invalid Parameters.",
           response = ApiError.class)
     })
 public Response createEvent(
     @ApiParam(
             value = "Event to be created. Category and Text fields required,",
             name = "event",
             required = true)
         final Event event) {
   try {
     if (null != event) {
       if (isEmpty(event.getId())) {
         return ResponseUtil.badRequest("Event with id null.");
       }
       if (isEmpty(event.getCategory())) {
         return ResponseUtil.badRequest("Event with category null.");
       }
       event.setTenantId(tenantId);
       if (null != alertsService.getEvent(tenantId, event.getId(), true)) {
         return ResponseUtil.badRequest("Event with ID [" + event.getId() + "] exists.");
       }
       /*
          New events are sent directly to the engine for inference process.
          Input events and new ones generated by the alerts engine are persisted at the end of the process.
       */
       alertsService.addEvents(Collections.singletonList(event));
       if (log.isDebugEnabled()) {
         log.debug("Event: " + event.toString());
       }
       return ResponseUtil.ok(event);
     } else {
       return ResponseUtil.badRequest("Event is null");
     }
   } catch (Exception e) {
     log.debug(e.getMessage(), e);
     if (e.getCause() != null && e.getCause() instanceof IllegalArgumentException) {
       return ResponseUtil.badRequest("Bad arguments: " + e.getMessage());
     }
     return ResponseUtil.internalError(e);
   }
 }