@RequestMapping(
      method = RequestMethod.GET,
      value = "/{refsetId}/history",
      produces = "application/json",
      consumes = "application/json")
  @ApiOperation(
      value = "Get all members history under a refset ",
      notes =
          "This api call is to get last 10 days of history of all members under given refset and for given range of members. "
              + "It is sorted by latest first."
              + "If user of this api want to retrieve specific dates history, they should provide from date and to date"
              + "in the format of yyyy-mm-dd")
  @PreAuthorize("hasRole('ROLE_USER')")
  public ResponseEntity<Result<Map<String, Object>>> getAllMembersHistory(
      @PathVariable String refsetId,
      @RequestParam(value = "fromDate", required = false) String fromDate,
      @RequestParam(value = "toDate", required = false) String toDate,
      @RequestParam(value = "from", defaultValue = "0", required = false) int from,
      @RequestParam(value = "to", defaultValue = "10", required = false) int to)
      throws Exception {

    logger.debug("getting all members history {}", refsetId);

    Result<Map<String, Object>> r = getResult();

    Map<String, ChangeRecord<Member>> history =
        service.getAllMembersHistory(
            refsetId, getFromDate(fromDate, 10), getToDate(toDate), from, to);

    Map<String, Object> data = new HashMap<String, Object>();
    data.put("history", history);
    r.getMeta()
        .add(
            linkTo(
                    methodOn(ChangeHistoryController.class)
                        .getAllMembersHistory(refsetId, fromDate, toDate, from, to))
                .withRel("All Member History"));

    r.setData(data);

    r.getMeta().setMessage(SUCCESS);
    r.getMeta().setStatus(HttpStatus.OK);

    return new ResponseEntity<Result<Map<String, Object>>>(r, HttpStatus.OK);
  }