Class UsageStatisticsResource

java.lang.Object
io.goobi.viewer.api.rest.v1.statistics.usage.UsageStatisticsResource

@Path("/statistics/usage") public class UsageStatisticsResource extends Object
REST resource providing usage statistics and access metrics for records and viewer resources, covering a single day or a range of days.
Author:
Florian Alpers
  • Field Details

  • Constructor Details

    • UsageStatisticsResource

      public UsageStatisticsResource()
  • Method Details

    • getStatisticsForDay

      @GET @Path("/{date}") @Produces({"application/json","text/plain","text/csv"}) public Response getStatisticsForDay(@PathParam("date") String date, @QueryParam("recordFilterQuery") String recordFilterQuery, @QueryParam("format") String inFormat) throws DAOException, IndexUnreachableException, PresentationException
      Returns usage statistics for a single day, aggregated across all indexed usage-statistics records for that day.

      The output format is taken from the format query parameter (json, text or csv); if it is omitted, the request's Accept header is used instead, and any other value falls back to JSON. The recordFilterQuery parameter restricts the counted requests to records matching an additional Solr query.

      Parameters:
      date - the date to observe, in format yyyy-MM-dd
      recordFilterQuery - additional Solr query used to restrict which records are counted
      inFormat - the format in which to return the data (json, text or csv; defaults to json)
      Returns:
      the usage statistics for the day, as JSON, plain text or CSV depending on the resolved format
      Throws:
      DAOException
      IndexUnreachableException
      PresentationException
    • getStatisticsListForDates

      @GET @Path("/{startDate}/{endDate}") @Produces({"application/json","text/plain","text/csv"}) public Response getStatisticsListForDates(@PathParam("startDate") String start, @PathParam("endDate") String end, @QueryParam("recordFilterQuery") String recordFilterQuery, @QueryParam("format") String inFormat, @QueryParam("step") Integer step, @QueryParam("stepUnit") String stepUnit) throws DAOException, IndexUnreachableException, PresentationException
      Returns usage statistics for a time frame, both as one combined summary and broken down into equal-length periods.

      The time frame is subdivided into periods of step times stepUnit (default: one day each); a period with no usage data is omitted from the list of individual summaries, while the combined summary aggregates data across the whole range (its reported start and end dates, however, reflect only where usage data actually exists, not necessarily the full requested range). If endDate lies in the future it is clamped to today; if it precedes startDate, the response status is 416 (Range Not Satisfiable) instead of a body. The output format is taken from the format query parameter (json, text or csv), falling back to the request's Accept header, then to JSON.

      Parameters:
      start - the first date to observe, in format yyyy-MM-dd
      end - the last date to observe, in format yyyy-MM-dd
      recordFilterQuery - additional Solr query used to restrict which records are counted
      inFormat - the format in which to return the data (json, text or csv; defaults to json)
      step - the number of time units (default: days) each statistics period should span
      stepUnit - the time unit for step (years, months, weeks or days)
      Returns:
      the combined and per-period usage statistics for the time frame, as JSON, plain text or CSV depending on the resolved format
      Throws:
      DAOException
      IndexUnreachableException
      PresentationException