The Metrics API provides counts of downloads, datasets created, files uploaded, and more, as described below. Dataverse also supports Make Data Count, which is described in the Make Data Count section of the Admin Guide.
Contents:
Note
CORS The Metrics API can be used from scripts running in web browsers, as it allows cross-origin resource sharing (CORS).
Note
For all metrics besides Past Days Count (/pastDays/$days
), Database setting MetricsCacheTimeoutMinutes
defines how long the cached value will be returned by subsequent queries.
Returns a count of various objects in dataverse over all-time:
GET https://$SERVER/api/info/metrics/$type
$type
can be set to dataverses
, datasets
, files
or downloads
.
Example: curl https://demo.dataverse.org/api/info/metrics/downloads
Returns a count of various objects in dataverse up to a specified month $YYYY-DD
in YYYY-MM format (e.g. 2018-01
):
GET https://$SERVER/api/info/metrics/$type/toMonth/$YYYY-DD
$type
can be set to dataverses
, datasets
, files
or downloads
.
Example: curl https://demo.dataverse.org/api/info/metrics/dataverses/toMonth/2018-01
Returns a count of various objects in dataverse for the past $days
(e.g. 30
):
GET https://$SERVER/api/info/metrics/$type/pastDays/$days
$type
can be set to dataverses
, datasets
, files
or downloads
.
Example: curl https://demo.dataverse.org/api/info/metrics/datasets/pastDays/30
Returns the number of dataverses by each subject:
GET https://$SERVER/api/info/metrics/dataverses/bySubject
Returns the number of dataverses by each category:
GET https://$SERVER/api/info/metrics/dataverses/byCategory
Returns the number of datasets by each subject:
GET https://$SERVER/api/info/metrics/datasets/bySubject
Returns the number of datasets by each subject, and up to a specified month $YYYY-DD
in YYYY-MM format (e.g. 2018-01
):
GET https://$SERVER/api/info/metrics/datasets/bySubject/toMonth/$YYYY-DD
Example: curl https://demo.dataverse.org/api/info/metrics/datasets/bySubject/toMonth/2018-01
To further tailor your metric, query parameters can be provided.
Specifies whether the metric should query local
data, remote
data (e.g. harvested), or all
data when getting results. Only works for dataset metrics.
Example: curl https://demo.dataverse.org/api/info/metrics/datasets/?dataLocation=remote