@GET @Produces("application/json") public EntityList<Record> get( @PathParam("id") String id, @DefaultValue("1") @QueryParam("start-index") Long startIndex, @DefaultValue("10") @QueryParam("max-results") Long maxResults, @Context UriInfo uriInfo) { List<QName> fieldQNames = ResourceClassUtil.parseFieldList(uriInfo); RecordId recordId = repository.getIdGenerator().fromString(id); List<Record> records; try { records = repository.readVersions(recordId, startIndex, startIndex + maxResults - 1, fieldQNames); return EntityList.create(records, uriInfo); } catch (RecordNotFoundException e) { throw new ResourceException(e, NOT_FOUND.getStatusCode()); } catch (Exception e) { throw new ResourceException( "Error loading record versions.", e, INTERNAL_SERVER_ERROR.getStatusCode()); } }