Class UsageStatisticsResource
- Author:
- Florian Alpers
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetStatisticsForDay(String date, String recordFilterQuery, String inFormat) Returns usage statistics for a single day, aggregated across all indexed usage-statistics records for that day.getStatisticsListForDates(String start, String end, String recordFilterQuery, String inFormat, Integer step, String stepUnit) Returns usage statistics for a time frame, both as one combined summary and broken down into equal-length periods.
-
Field Details
-
DATE_FORMAT
- See Also:
-
-
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
formatquery 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. TherecordFilterQueryparameter restricts the counted requests to records matching an additional Solr query.- Parameters:
date- the date to observe, in format yyyy-MM-ddrecordFilterQuery- additional Solr query used to restrict which records are countedinFormat- 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:
DAOExceptionIndexUnreachableExceptionPresentationException
-
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
steptimesstepUnit(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). IfendDatelies in the future it is clamped to today; if it precedesstartDate, the response status is 416 (Range Not Satisfiable) instead of a body. The output format is taken from theformatquery 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-ddend- the last date to observe, in format yyyy-MM-ddrecordFilterQuery- additional Solr query used to restrict which records are countedinFormat- 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 spanstepUnit- 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:
DAOExceptionIndexUnreachableExceptionPresentationException
-